| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | //-------------------------------------------------------- | ||
| 2 | // ZQuest Classic | ||
| 3 | // by Jeremy Craner, 1999-2000 | ||
| 4 | // | ||
| 5 | // zc_sys.cc | ||
| 6 | // | ||
| 7 | // System functions, input handlers, GUI stuff, etc. | ||
| 8 | // for ZQuest Classic. | ||
| 9 | // | ||
| 10 | //-------------------------------------------------------- | ||
| 11 | |||
| 12 | #include "zc/zc_sys.h" | ||
| 13 | |||
| 14 | #include "base/qrs.h" | ||
| 15 | #include "base/dmap.h" | ||
| 16 | #include <stdio.h> | ||
| 17 |
1/2✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
|
46 | #include <stdlib.h> |
| 18 | #include <string.h> | ||
| 19 | #include <math.h> | ||
| 20 | #include <map> | ||
| 21 | #include <filesystem> | ||
| 22 | #include <ctype.h> | ||
| 23 | #include <sstream> | ||
| 24 | #include "base/zc_alleg.h" | ||
| 25 | #include "gamedata.h" | ||
| 26 | #include "zc/zc_init.h" | ||
| 27 | #include "init.h" | ||
| 28 | #include "zc/replay.h" | ||
| 29 | #include "zc/cheats.h" | ||
| 30 | #include "zc/render.h" | ||
| 31 | #include "base/zc_math.h" | ||
| 32 | #include "base/zapp.h" | ||
| 33 | #include "dialog/cheatkeys.h" | ||
| 34 | #include "metadata/metadata.h" | ||
| 35 | #include "zc/zelda.h" | ||
| 36 | #include "tiles.h" | ||
| 37 | #include "base/colors.h" | ||
| 38 | #include "pal.h" | ||
| 39 | #include "base/zsys.h" | ||
| 40 | #include "qst.h" | ||
| 41 | #include "zc/zc_sys.h" | ||
| 42 | #include "play_midi.h" | ||
| 43 | #include "jwin_a5.h" | ||
| 44 | #include "base/jwinfsel.h" | ||
| 45 | #include "base/gui.h" | ||
| 46 | #include "midi.h" | ||
| 47 | #include "subscr.h" | ||
| 48 | #include "zc/maps.h" | ||
| 49 | #include "sprite.h" | ||
| 50 | #include "zc/guys.h" | ||
| 51 | #include "zc/hero.h" | ||
| 52 | #include "zc/title.h" | ||
| 53 | #include "particles.h" | ||
| 54 | #include "zconsole.h" | ||
| 55 | #include "zc/ffscript.h" | ||
| 56 | #include "dialog/info.h" | ||
| 57 | #include "dialog/alert.h" | ||
| 58 | #include "zc/combos.h" | ||
| 59 | #include "zc/jit.h" | ||
| 60 | #include <fmt/format.h> | ||
| 61 | #include "zinfo.h" | ||
| 62 | #include "base/misctypes.h" | ||
| 63 | |||
| 64 | #ifdef __EMSCRIPTEN__ | ||
| 65 | #include "base/emscripten_utils.h" | ||
| 66 | #endif | ||
| 67 | |||
| 68 | extern FFScript FFCore; | ||
| 69 | extern bool Playing; | ||
| 70 | int32_t sfx_voice[WAV_COUNT]; | ||
| 71 | int32_t d_stringloader(int32_t msg,DIALOG *d,int32_t c); | ||
| 72 | int32_t d_midilist_proc(int32_t msg,DIALOG *d,int32_t c); | ||
| 73 | |||
| 74 | extern byte monochrome_console; | ||
| 75 | |||
| 76 | extern HeroClass Hero; | ||
| 77 | extern FFScript FFCore; | ||
| 78 | extern ZModule zcm; | ||
| 79 | extern zcmodule moduledata; | ||
| 80 | extern sprite_list guys, items, Ewpns, Lwpns, Sitems, chainlinks, decorations; | ||
| 81 | extern particle_list particles; | ||
| 82 | extern int32_t loadlast; | ||
| 83 | extern char *sfx_string[WAV_COUNT]; | ||
| 84 | byte use_dwm_flush; | ||
| 85 | byte use_save_indicator; | ||
| 86 | int32_t paused_midi_pos = 0; | ||
| 87 | byte midi_suspended = 0; | ||
| 88 | byte zc_192b163_warp_compatibility; | ||
| 89 | char modulepath[2048]; | ||
| 90 | bool epilepsyFlashReduction; | ||
| 91 | signed char pause_in_background_menu_init = 0; | ||
| 92 | byte pause_in_background = 0; | ||
| 93 | bool is_sys_pal = false; | ||
| 94 | static bool load_control_called_this_frame; | ||
| 95 | extern PALETTE* hw_palette; | ||
| 96 | extern bool update_hw_pal; | ||
| 97 | extern const char* dmaplist(int32_t index, int32_t* list_size); | ||
| 98 | int32_t getnumber(const char *prompt,int32_t initialval); | ||
| 99 | |||
| 100 | extern bool kb_typing_mode; //script only, for disbaling key presses affecting Hero, etc. | ||
| 101 | ✗ | extern int32_t cheat_modifier_keys[4]; //two options each, default either control and either shift | |
| 102 | //extern byte refresh_select_screen; | ||
| 103 | //extern movingblock mblock2; //mblock[4]? | ||
| 104 | //extern int32_t db; | ||
| 105 | |||
| 106 | static const char *ZC_str = "ZQuest Classic"; | ||
| 107 | extern char save_file_name[1024]; | ||
| 108 | #if defined(ALLEGRO_WINDOWS) | ||
| 109 | const char *qst_dir_name = "win_qst_dir"; | ||
| 110 | static const char *qst_module_name = "current_module"; | ||
| 111 | #elif defined(ALLEGRO_LINUX) | ||
| 112 | const char *qst_dir_name = "linux_qst_dir"; | ||
| 113 | static const char *qst_module_name = "current_module"; | ||
| 114 | #elif defined(__APPLE__) | ||
| 115 | const char *qst_dir_name = "osx_qst_dir"; | ||
| 116 | static const char *qst_module_name = "current_module"; | ||
| 117 | #endif | ||
| 118 | #ifdef ALLEGRO_LINUX | ||
| 119 | static const char *samplepath = "samplesoundset/patches.dat"; | ||
| 120 | #endif | ||
| 121 | char qst_files_path[2048]; | ||
| 122 | |||
| 123 | #ifdef _MSC_VER | ||
| 124 | #define getcwd _getcwd | ||
| 125 | #endif | ||
| 126 | |||
| 127 | bool rF11(); | ||
| 128 | bool rI(); | ||
| 129 | bool rQ(); | ||
| 130 | bool zc_key_pressed(); | ||
| 131 | |||
| 132 | #ifdef _WIN32 | ||
| 133 | |||
| 134 | // This should only be necessary for MinGW, since it doesn't have a dwmapi.h. Add another #ifdef if you like. | ||
| 135 | extern "C" | ||
| 136 | { | ||
| 137 | typedef HRESULT(WINAPI *t_DwmFlush)(); | ||
| 138 | typedef HRESULT(WINAPI *t_DwmIsCompositionEnabled)(BOOL *pfEnabled); | ||
| 139 | } | ||
| 140 | |||
| 141 | void do_DwmFlush() | ||
| 142 | { | ||
| 143 | static HMODULE shell = LoadLibrary("dwmapi.dll"); | ||
| 144 | |||
| 145 | if(!shell) | ||
| 146 | return; | ||
| 147 | |||
| 148 | static t_DwmFlush flush=reinterpret_cast<t_DwmFlush>(GetProcAddress(shell, "DwmFlush")); | ||
| 149 | static t_DwmIsCompositionEnabled isEnabled=reinterpret_cast<t_DwmIsCompositionEnabled>(GetProcAddress(shell, "DwmIsCompositionEnabled")); | ||
| 150 | |||
| 151 | BOOL enabled; | ||
| 152 | isEnabled(&enabled); | ||
| 153 | |||
| 154 | if(isEnabled) | ||
| 155 | flush(); | ||
| 156 | } | ||
| 157 | |||
| 158 | #endif // _WIN32 | ||
| 159 | |||
| 160 | 83751 | bool flash_reduction_enabled(bool check_qr) | |
| 161 | { | ||
| 162 |
4/4✓ Branch 0 taken 81530 times.
✓ Branch 1 taken 2221 times.
✓ Branch 2 taken 81074 times.
✓ Branch 3 taken 83295 times.
|
83751 | return (check_qr && get_qr(qr_EPILEPSY)) || epilepsyFlashReduction || replay_is_debug(); |
| 163 | } | ||
| 164 | |||
| 165 | // Dialogue largening | ||
| 166 | ✗ | void large_dialog(DIALOG *d) | |
| 167 | { | ||
| 168 | ✗ | large_dialog(d, 1.5); | |
| 169 | ✗ | } | |
| 170 | |||
| 171 | ✗ | void large_dialog(DIALOG *d, float RESIZE_AMT) | |
| 172 | { | ||
| 173 | ✗ | if(!d[0].d1) | |
| 174 | { | ||
| 175 | ✗ | d[0].d1 = 1; | |
| 176 | ✗ | int32_t oldwidth = d[0].w; | |
| 177 | ✗ | int32_t oldheight = d[0].h; | |
| 178 | ✗ | int32_t oldx = d[0].x; | |
| 179 | ✗ | int32_t oldy = d[0].y; | |
| 180 | ✗ | d[0].x -= int32_t(d[0].w/RESIZE_AMT); | |
| 181 | ✗ | d[0].y -= int32_t(d[0].h/RESIZE_AMT); | |
| 182 | ✗ | d[0].w = int32_t(d[0].w*RESIZE_AMT); | |
| 183 | ✗ | d[0].h = int32_t(d[0].h*RESIZE_AMT); | |
| 184 | |||
| 185 | ✗ | for(int32_t i=1; d[i].proc !=NULL; i++) | |
| 186 | { | ||
| 187 | // Place elements horizontally | ||
| 188 | ✗ | double xpc = ((double)(d[i].x - oldx) / (double)oldwidth); | |
| 189 | ✗ | d[i].x = int32_t(d[0].x + (xpc*d[0].w)); | |
| 190 | |||
| 191 | ✗ | if(d[i].proc != d_stringloader) | |
| 192 | { | ||
| 193 | ✗ | if(d[i].proc==d_bitmap_proc) | |
| 194 | { | ||
| 195 | ✗ | d[i].w *= 2; | |
| 196 | ✗ | } | |
| 197 | ✗ | else d[i].w = int32_t(d[i].w*RESIZE_AMT); | |
| 198 | ✗ | } | |
| 199 | |||
| 200 | // Place elements vertically | ||
| 201 | ✗ | double ypc = ((double)(d[i].y - oldy) / (double)oldheight); | |
| 202 | ✗ | d[i].y = int32_t(d[0].y + (ypc*d[0].h)); | |
| 203 | |||
| 204 | // Vertically resize elements | ||
| 205 | ✗ | if(d[i].proc == jwin_edit_proc || d[i].proc == jwin_check_proc || d[i].proc == jwin_checkfont_proc) | |
| 206 | { | ||
| 207 | ✗ | d[i].h = int32_t((double)d[i].h*1.5); | |
| 208 | ✗ | } | |
| 209 | ✗ | else if(d[i].proc == jwin_droplist_proc) | |
| 210 | { | ||
| 211 | ✗ | d[i].y += int32_t((double)d[i].h*0.25); | |
| 212 | ✗ | d[i].h = int32_t((double)d[i].h*1.25); | |
| 213 | ✗ | } | |
| 214 | ✗ | else if(d[i].proc==d_bitmap_proc) | |
| 215 | { | ||
| 216 | ✗ | d[i].h *= 2; | |
| 217 | ✗ | } | |
| 218 | ✗ | else d[i].h = int32_t(d[i].h*RESIZE_AMT); | |
| 219 | |||
| 220 | // Fix frames | ||
| 221 | ✗ | if(d[i].proc == jwin_frame_proc) | |
| 222 | { | ||
| 223 | ✗ | d[i].x++; | |
| 224 | ✗ | d[i].y++; | |
| 225 | ✗ | d[i].w-=4; | |
| 226 | ✗ | d[i].h-=4; | |
| 227 | ✗ | } | |
| 228 | ✗ | } | |
| 229 | ✗ | } | |
| 230 | |||
| 231 | ✗ | for(int32_t i=1; d[i].proc!=NULL; i++) | |
| 232 | { | ||
| 233 | ✗ | if(d[i].proc==jwin_slider_proc) | |
| 234 | ✗ | continue; | |
| 235 | |||
| 236 | // Bigger font | ||
| 237 | ✗ | bool bigfontproc = (d[i].proc != d_midilist_proc && d[i].proc != jwin_droplist_proc && d[i].proc != jwin_abclist_proc && d[i].proc != jwin_list_proc); | |
| 238 | |||
| 239 | ✗ | if(!d[i].dp2 && bigfontproc) | |
| 240 | { | ||
| 241 | ✗ | d[i].dp2 = get_zc_font(font_lfont_l); | |
| 242 | ✗ | } | |
| 243 | ✗ | else if(!bigfontproc) | |
| 244 | { | ||
| 245 | ✗ | ((ListData *)d[i].dp)->font = &a4fonts[font_lfont_l]; | |
| 246 | ✗ | } | |
| 247 | |||
| 248 | // Make checkboxes work | ||
| 249 | ✗ | if(d[i].proc == jwin_check_proc) | |
| 250 | ✗ | d[i].proc = jwin_checkfont_proc; | |
| 251 | ✗ | else if(d[i].proc == jwin_radio_proc) | |
| 252 | ✗ | d[i].proc = jwin_radiofont_proc; | |
| 253 | ✗ | } | |
| 254 | |||
| 255 | ✗ | jwin_center_dialog(d); | |
| 256 | ✗ | } | |
| 257 | |||
| 258 | |||
| 259 | /**********************************/ | ||
| 260 | /******** System functions ********/ | ||
| 261 | /**********************************/ | ||
| 262 | |||
| 263 | static char cfg_sect[] = "zeldadx"; //We need to rename this. | ||
| 264 | static char ctrl_sect[] = "Controls"; | ||
| 265 | static char sfx_sect[] = "Volume"; | ||
| 266 | |||
| 267 | ✗ | int32_t d_dummy_proc(int32_t,DIALOG *,int32_t) | |
| 268 | { | ||
| 269 | ✗ | return D_O_K; | |
| 270 | } | ||
| 271 | |||
| 272 | ✗ | bool is_reserved_key(int c) | |
| 273 | { | ||
| 274 | ✗ | switch(c) | |
| 275 | { | ||
| 276 | case KEY_ESC: | ||
| 277 | ✗ | return true; | |
| 278 | } | ||
| 279 | ✗ | return false; | |
| 280 | ✗ | } | |
| 281 | ✗ | bool is_reserved_keycombo(int c, int modflag) | |
| 282 | { | ||
| 283 | ✗ | if(c==KEY_F4 && (modflag&KB_ALT_FLAG)) | |
| 284 | ✗ | return true; | |
| 285 | ✗ | return false; | |
| 286 | ✗ | } | |
| 287 | ✗ | bool checkcheat(Cheat cheat) | |
| 288 | { | ||
| 289 | ✗ | if(cheatkeys[cheat][0] && zc_readkey(cheatkeys[cheat][0])) | |
| 290 | ✗ | return true; //Main key pressed | |
| 291 | ✗ | if(cheatkeys[cheat][1] && zc_readkey(cheatkeys[cheat][1])) | |
| 292 | ✗ | return true; //Alt key pressed | |
| 293 | ✗ | return false; | |
| 294 | ✗ | } | |
| 295 | 46 | void load_default_cheatkeys() | |
| 296 | { | ||
| 297 | 46 | memset(cheatkeys, 0, sizeof(cheatkeys)); | |
| 298 | 46 | cheatkeys[Cheat::Life][0] = KEY_H; | |
| 299 | 46 | cheatkeys[Cheat::Life][1] = KEY_ASTERISK; | |
| 300 | 46 | cheatkeys[Cheat::Magic][0] = KEY_M; | |
| 301 | 46 | cheatkeys[Cheat::Magic][1] = KEY_SLASH_PAD; | |
| 302 | 46 | cheatkeys[Cheat::Rupies][0] = KEY_R; | |
| 303 | 46 | cheatkeys[Cheat::Bombs][0] = KEY_B; | |
| 304 | 46 | cheatkeys[Cheat::Arrows][0] = KEY_A; | |
| 305 | 46 | cheatkeys[Cheat::Clock][0] = KEY_I; | |
| 306 | 46 | cheatkeys[Cheat::Walls][0] = KEY_F11; | |
| 307 | 46 | cheatkeys[Cheat::Fast][0] = KEY_Q; | |
| 308 | 46 | cheatkeys[Cheat::Light][0] = KEY_L; | |
| 309 | 46 | cheatkeys[Cheat::IgnoreSideView][0] = KEY_V; | |
| 310 | 46 | cheatkeys[Cheat::Kill][0] = KEY_K; | |
| 311 | 46 | cheatkeys[Cheat::GoTo][0] = KEY_G; | |
| 312 | 46 | cheatkeys[Cheat::TrigSecrets][0] = KEY_S; | |
| 313 | 46 | cheatkeys[Cheat::ShowL0][0] = KEY_0; | |
| 314 | 46 | cheatkeys[Cheat::ShowL1][0] = KEY_1; | |
| 315 | 46 | cheatkeys[Cheat::ShowL2][0] = KEY_2; | |
| 316 | 46 | cheatkeys[Cheat::ShowL3][0] = KEY_3; | |
| 317 | 46 | cheatkeys[Cheat::ShowL4][0] = KEY_4; | |
| 318 | 46 | cheatkeys[Cheat::ShowL5][0] = KEY_5; | |
| 319 | 46 | cheatkeys[Cheat::ShowL6][0] = KEY_6; | |
| 320 | 46 | cheatkeys[Cheat::ShowFFC][0] = KEY_7; | |
| 321 | 46 | cheatkeys[Cheat::ShowSprites][0] = KEY_8; | |
| 322 | 46 | cheatkeys[Cheat::ShowWalkability][0] = KEY_W; | |
| 323 | 46 | cheatkeys[Cheat::ShowEffects][0] = KEY_E; | |
| 324 | 46 | cheatkeys[Cheat::ShowOverhead][0] = KEY_O; | |
| 325 | 46 | cheatkeys[Cheat::ShowPushblock][0] = KEY_P; | |
| 326 | 46 | cheatkeys[Cheat::ShowHitbox][0] = KEY_C; | |
| 327 | 46 | cheatkeys[Cheat::ShowFFCScripts][0] = KEY_F; | |
| 328 | 46 | } | |
| 329 | 46 | void load_game_configs() | |
| 330 | { | ||
| 331 | 46 | strcpy(moduledata.module_name,zc_get_config("ZCMODULE",qst_module_name,"classic.zmod")); | |
| 332 | 46 | joystick_index = zc_get_config(ctrl_sect,"joystick_index",0); | |
| 333 | 46 | js_stick_1_x_stick = zc_get_config(ctrl_sect,"js_stick_1_x_stick",0); | |
| 334 | 46 | js_stick_1_x_axis = zc_get_config(ctrl_sect,"js_stick_1_x_axis",0); | |
| 335 | 46 | js_stick_1_x_offset = zc_get_config(ctrl_sect,"js_stick_1_x_offset",0) ? 128 : 0; | |
| 336 | 46 | js_stick_1_y_stick = zc_get_config(ctrl_sect,"js_stick_1_y_stick",0); | |
| 337 | 46 | js_stick_1_y_axis = zc_get_config(ctrl_sect,"js_stick_1_y_axis",1); | |
| 338 | 46 | js_stick_1_y_offset = zc_get_config(ctrl_sect,"js_stick_1_y_offset",0) ? 128 : 0; | |
| 339 | 46 | js_stick_2_x_stick = zc_get_config(ctrl_sect,"js_stick_2_x_stick",1); | |
| 340 | 46 | js_stick_2_x_axis = zc_get_config(ctrl_sect,"js_stick_2_x_axis",0); | |
| 341 | 46 | js_stick_2_x_offset = zc_get_config(ctrl_sect,"js_stick_2_x_offset",0) ? 128 : 0; | |
| 342 | 46 | js_stick_2_y_stick = zc_get_config(ctrl_sect,"js_stick_2_y_stick",1); | |
| 343 | 46 | js_stick_2_y_axis = zc_get_config(ctrl_sect,"js_stick_2_y_axis",1); | |
| 344 | 46 | js_stick_2_y_offset = zc_get_config(ctrl_sect,"js_stick_2_y_offset",0) ? 128 : 0; | |
| 345 | 46 | analog_movement = (zc_get_config(ctrl_sect,"analog_movement",1)); | |
| 346 | |||
| 347 | //cheat modifier keya | ||
| 348 | 46 | cheat_modifier_keys[0] = zc_get_config(ctrl_sect,"key_cheatmod_a1",KEY_ZC_LCONTROL); | |
| 349 | 46 | cheat_modifier_keys[1] = zc_get_config(ctrl_sect,"key_cheatmod_a2",0); | |
| 350 | 46 | cheat_modifier_keys[2] = zc_get_config(ctrl_sect,"key_cheatmod_b1",KEY_ZC_RCONTROL); | |
| 351 | 46 | cheat_modifier_keys[3] = zc_get_config(ctrl_sect,"key_cheatmod_b2",0); | |
| 352 | |||
| 353 | //cheat keys | ||
| 354 | 46 | load_default_cheatkeys(); | |
| 355 | char buf[256]; | ||
| 356 |
2/2✓ Branch 0 taken 1610 times.
✓ Branch 1 taken 46 times.
|
1656 | for(size_t q = 1; q < Cheat::Last; ++q) |
| 357 | { | ||
| 358 |
1/2✓ Branch 0 taken 1610 times.
✗ Branch 1 not taken.
|
1610 | if(!bindable_cheat((Cheat)q)) continue; |
| 359 | 1610 | std::string cheatname = cheat_to_string((Cheat)q); | |
| 360 |
1/2✓ Branch 0 taken 1610 times.
✗ Branch 1 not taken.
|
1610 | util::lowerstr(cheatname); |
| 361 | 1610 | sprintf(buf, "key_cheat_%s_main", cheatname.c_str()); | |
| 362 |
1/2✓ Branch 0 taken 1610 times.
✗ Branch 1 not taken.
|
1610 | cheatkeys[q][0] = zc_get_config(ctrl_sect,buf,cheatkeys[q][0]); |
| 363 | 1610 | sprintf(buf, "key_cheat_%s_alt", cheatname.c_str()); | |
| 364 |
1/2✓ Branch 0 taken 1610 times.
✗ Branch 1 not taken.
|
1610 | cheatkeys[q][1] = zc_get_config(ctrl_sect,buf,cheatkeys[q][1]); |
| 365 | 1610 | } | |
| 366 | |||
| 367 |
1/2✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
|
46 | if((uint32_t)joystick_index >= MAX_JOYSTICKS) |
| 368 | ✗ | joystick_index = 0; | |
| 369 | |||
| 370 | 46 | Akey = zc_get_config(ctrl_sect,"key_a",KEY_Z); | |
| 371 | 46 | Bkey = zc_get_config(ctrl_sect,"key_b",KEY_X); | |
| 372 | 46 | Skey = zc_get_config(ctrl_sect,"key_s",KEY_ENTER); | |
| 373 | 46 | Lkey = zc_get_config(ctrl_sect,"key_l",KEY_Q); | |
| 374 | 46 | Rkey = zc_get_config(ctrl_sect,"key_r",KEY_W); | |
| 375 | 46 | Pkey = zc_get_config(ctrl_sect,"key_p",KEY_SPACE); | |
| 376 | 46 | Exkey1 = zc_get_config(ctrl_sect,"key_ex1",KEY_A); | |
| 377 | 46 | Exkey2 = zc_get_config(ctrl_sect,"key_ex2",KEY_S); | |
| 378 | 46 | Exkey3 = zc_get_config(ctrl_sect,"key_ex3",KEY_D); | |
| 379 | 46 | Exkey4 = zc_get_config(ctrl_sect,"key_ex4",KEY_C); | |
| 380 | |||
| 381 | 46 | DUkey = zc_get_config(ctrl_sect,"key_up", KEY_UP); | |
| 382 | 46 | DDkey = zc_get_config(ctrl_sect,"key_down", KEY_DOWN); | |
| 383 | 46 | DLkey = zc_get_config(ctrl_sect,"key_left", KEY_LEFT); | |
| 384 | 46 | DRkey = zc_get_config(ctrl_sect,"key_right",KEY_RIGHT); | |
| 385 | |||
| 386 | 46 | Abtn = zc_get_config(ctrl_sect,"btn_a",2); | |
| 387 | 46 | Bbtn = zc_get_config(ctrl_sect,"btn_b",1); | |
| 388 | 46 | Sbtn = zc_get_config(ctrl_sect,"btn_s",10); | |
| 389 | 46 | Mbtn = zc_get_config(ctrl_sect,"btn_m",9); | |
| 390 | 46 | Lbtn = zc_get_config(ctrl_sect,"btn_l",5); | |
| 391 | 46 | Rbtn = zc_get_config(ctrl_sect,"btn_r",6); | |
| 392 | 46 | Pbtn = zc_get_config(ctrl_sect,"btn_p",12); | |
| 393 | 46 | Exbtn1 = zc_get_config(ctrl_sect,"btn_ex1",7); | |
| 394 | 46 | Exbtn2 = zc_get_config(ctrl_sect,"btn_ex2",8); | |
| 395 | 46 | Exbtn3 = zc_get_config(ctrl_sect,"btn_ex3",4); | |
| 396 | 46 | Exbtn4 = zc_get_config(ctrl_sect,"btn_ex4",3); | |
| 397 | |||
| 398 | 46 | DUbtn = zc_get_config(ctrl_sect,"btn_up",13); | |
| 399 | 46 | DDbtn = zc_get_config(ctrl_sect,"btn_down",14); | |
| 400 | 46 | DLbtn = zc_get_config(ctrl_sect,"btn_left",15); | |
| 401 | 46 | DRbtn = zc_get_config(ctrl_sect,"btn_right",16); | |
| 402 | |||
| 403 | 46 | epilepsyFlashReduction = zc_get_config(cfg_sect,"epilepsy_flash_reduction",0); | |
| 404 | |||
| 405 | 46 | digi_volume = zc_get_config(sfx_sect,"digi",248); | |
| 406 | 46 | midi_volume = zc_get_config(sfx_sect,"midi",255); | |
| 407 | 46 | sfx_volume = zc_get_config(sfx_sect,"sfx",248); | |
| 408 | 46 | emusic_volume = zc_get_config(sfx_sect,"emusic",248); | |
| 409 | 46 | pan_style = zc_get_config(sfx_sect,"pan",1); | |
| 410 | // 1 <= zcmusic_bufsz <= 128 | ||
| 411 | 46 | zcmusic_bufsz = vbound(zc_get_config(sfx_sect,"zcmusic_bufsz",64),1,128); | |
| 412 | 46 | volkeys = zc_get_config(sfx_sect,"volkeys",0)!=0; | |
| 413 | 46 | zc_vsync = zc_get_config(cfg_sect,"vsync",0); | |
| 414 | 46 | Throttlefps = zc_get_config(cfg_sect,"throttlefps",1)!=0; | |
| 415 | 46 | TransLayers = zc_get_config(cfg_sect,"translayers",1)!=0; | |
| 416 | 46 | SnapshotFormat = zc_get_config(cfg_sect,"snapshot_format",3); | |
| 417 | 46 | NameEntryMode = zc_get_config(cfg_sect,"name_entry_mode",0); | |
| 418 | #ifdef __EMSCRIPTEN__ | ||
| 419 | if (em_is_mobile()) NameEntryMode = 2; | ||
| 420 | #endif | ||
| 421 | 46 | ShowFPS = zc_get_config(cfg_sect,"showfps",0)!=0; | |
| 422 | 46 | NESquit = zc_get_config(cfg_sect,"fastquit",0)!=0; | |
| 423 | 46 | ClickToFreeze = zc_get_config(cfg_sect,"clicktofreeze",1)!=0; | |
| 424 | 46 | title_version = zc_get_config(cfg_sect,"title",2); | |
| 425 | 46 | abc_patternmatch = zc_get_config(cfg_sect, "lister_pattern_matching", 1); | |
| 426 | 46 | pause_in_background = zc_get_config(cfg_sect, "pause_in_background", 0); | |
| 427 | |||
| 428 | //default - scale x2, 640 x 480 | ||
| 429 | 46 | window_width = resx = zc_get_config(cfg_sect,"window_width",640); | |
| 430 | 46 | window_height = resy = zc_get_config(cfg_sect,"window_height",480); | |
| 431 | 46 | SaveDragResize = zc_get_config(cfg_sect,"save_drag_resize",0)!=0; | |
| 432 | 46 | DragAspect = zc_get_config(cfg_sect,"drag_aspect",0)!=0; | |
| 433 | 46 | SaveWinPos = zc_get_config(cfg_sect,"save_window_position",0)!=0; | |
| 434 | 46 | scaleForceInteger = zc_get_config("zeldadx","scaling_force_integer",1)!=0; | |
| 435 | 46 | stretchGame = zc_get_config("zeldadx","stretch_game_area",0)!=0; | |
| 436 | |||
| 437 | 46 | loadlast = zc_get_config(cfg_sect,"load_last",0); | |
| 438 | |||
| 439 | 46 | fullscreen = zc_get_config(cfg_sect,"fullscreen",0); | |
| 440 | |||
| 441 | 46 | zc_color_depth = (byte) zc_get_config(cfg_sect,"color_depth",8); | |
| 442 | |||
| 443 | 46 | forceExit = (byte) zc_get_config(cfg_sect,"force_exit",0); | |
| 444 | 46 | info_opacity = zc_get_config("zc","debug_info_opacity",255); | |
| 445 | #ifdef _WIN32 | ||
| 446 | zasm_debugger = (byte) zc_get_config("CONSOLE","print_ZASM",0); | ||
| 447 | zscript_debugger = (byte) zc_get_config("CONSOLE","ZScript_Debugger",0); | ||
| 448 | //use_win7_keyboard_fix = (byte) zc_get_config(cfg_sect,"use_win7_key_fix",0); | ||
| 449 | use_win32_proc = (byte) zc_get_config(cfg_sect,"zc_win_proc_fix",0); //buggy | ||
| 450 | |||
| 451 | // This one's for Aero | ||
| 452 | use_dwm_flush = (byte) zc_get_config("zeldadx","use_dwm_flush",0); | ||
| 453 | |||
| 454 | monochrome_console = (byte) zc_get_config("CONSOLE","monochrome_debuggers",0); | ||
| 455 | #else //UNIX | ||
| 456 | 46 | zasm_debugger = (byte) zc_get_config("CONSOLE","print_ZASM",0); | |
| 457 | 46 | zscript_debugger = (byte) zc_get_config("CONSOLE","ZScript_Debugger",0); | |
| 458 | 46 | monochrome_console = (byte) zc_get_config("CONSOLE","monochrome_debuggers",0); | |
| 459 | #endif | ||
| 460 | 46 | clearConsoleOnLoad = zc_get_config("CONSOLE","clear_console_on_load",1)!=0; | |
| 461 | 46 | clearConsoleOnReload = zc_get_config("CONSOLE","clear_console_on_reload",0)!=0; | |
| 462 | |||
| 463 | 46 | strcpy(qstdir,zc_get_config(cfg_sect,qst_dir_name,"")); | |
| 464 | |||
| 465 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
|
46 | if(strlen(qstdir)==0) |
| 466 | { | ||
| 467 | 46 | getcwd(qstdir,2048); | |
| 468 | 46 | fix_filename_case(qstdir); | |
| 469 | 46 | fix_filename_slashes(qstdir); | |
| 470 | 46 | put_backslash(qstdir); | |
| 471 | 46 | } | |
| 472 | else | ||
| 473 | { | ||
| 474 | ✗ | chop_path(qstdir); | |
| 475 | } | ||
| 476 | |||
| 477 | 46 | strcpy(qstpath,qstdir); //qstpath is the local (for this run of ZC) quest path, qstdir is the universal quest dir. | |
| 478 | 46 | ss_enable = zc_get_config(cfg_sect,"ss_enable",1) ? 1 : 0; | |
| 479 | 46 | ss_after = vbound(zc_get_config(cfg_sect,"ss_after",14), 0, 14); | |
| 480 | 46 | ss_speed = vbound(zc_get_config(cfg_sect,"ss_speed",2), 0, 6); | |
| 481 | 46 | ss_density = vbound(zc_get_config(cfg_sect,"ss_density",3), 0, 6); | |
| 482 | 46 | heart_beep = zc_get_config(cfg_sect,"heart_beep",1)!=0; | |
| 483 | //gui_colorset = zc_get_config(cfg_sect,"gui_colorset",0); | ||
| 484 | 46 | sfxdat = zc_get_config(cfg_sect,"use_sfx_dat",1); | |
| 485 | 46 | fullscreen = zc_get_config(cfg_sect,"fullscreen",0); | |
| 486 | 46 | use_save_indicator = zc_get_config(cfg_sect,"save_indicator",0); | |
| 487 | 46 | zc_192b163_warp_compatibility = zc_get_config(cfg_sect,"zc_192b163_warp_compatibility",0); | |
| 488 | 46 | } | |
| 489 | |||
| 490 | ✗ | void save_control_configs(bool kb) | |
| 491 | { | ||
| 492 | ✗ | if(kb) | |
| 493 | { | ||
| 494 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_a1",cheat_modifier_keys[0]); | |
| 495 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_a2",cheat_modifier_keys[1]); | |
| 496 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_b1",cheat_modifier_keys[2]); | |
| 497 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_b2",cheat_modifier_keys[3]); | |
| 498 | |||
| 499 | ✗ | if (!replay_is_replaying()) | |
| 500 | { | ||
| 501 | ✗ | zc_set_config(ctrl_sect,"key_a",Akey); | |
| 502 | ✗ | zc_set_config(ctrl_sect,"key_b",Bkey); | |
| 503 | ✗ | zc_set_config(ctrl_sect,"key_s",Skey); | |
| 504 | ✗ | zc_set_config(ctrl_sect,"key_l",Lkey); | |
| 505 | ✗ | zc_set_config(ctrl_sect,"key_r",Rkey); | |
| 506 | ✗ | zc_set_config(ctrl_sect,"key_p",Pkey); | |
| 507 | ✗ | zc_set_config(ctrl_sect,"key_ex1",Exkey1); | |
| 508 | ✗ | zc_set_config(ctrl_sect,"key_ex2",Exkey2); | |
| 509 | ✗ | zc_set_config(ctrl_sect,"key_ex3",Exkey3); | |
| 510 | ✗ | zc_set_config(ctrl_sect,"key_ex4",Exkey4); | |
| 511 | ✗ | zc_set_config(ctrl_sect,"key_up", DUkey); | |
| 512 | ✗ | zc_set_config(ctrl_sect,"key_down", DDkey); | |
| 513 | ✗ | zc_set_config(ctrl_sect,"key_left", DLkey); | |
| 514 | ✗ | zc_set_config(ctrl_sect,"key_right",DRkey); | |
| 515 | ✗ | } | |
| 516 | ✗ | } | |
| 517 | else | ||
| 518 | { | ||
| 519 | ✗ | zc_set_config(ctrl_sect,"joystick_index",joystick_index); | |
| 520 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_x_stick",js_stick_1_x_stick); | |
| 521 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_x_axis",js_stick_1_x_axis); | |
| 522 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_x_offset",js_stick_1_x_offset ? 1 : 0); | |
| 523 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_y_stick",js_stick_1_y_stick); | |
| 524 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_y_axis",js_stick_1_y_axis); | |
| 525 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_y_offset",js_stick_1_y_offset ? 1 : 0); | |
| 526 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_x_stick",js_stick_2_x_stick); | |
| 527 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_x_axis",js_stick_2_x_axis); | |
| 528 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_x_offset",js_stick_2_x_offset ? 1 : 0); | |
| 529 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_y_stick",js_stick_2_y_stick); | |
| 530 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_y_axis",js_stick_2_y_axis); | |
| 531 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_y_offset",js_stick_2_y_offset ? 1 : 0); | |
| 532 | ✗ | zc_set_config(ctrl_sect,"analog_movement",analog_movement); | |
| 533 | |||
| 534 | ✗ | zc_set_config(ctrl_sect,"btn_a",Abtn); | |
| 535 | ✗ | zc_set_config(ctrl_sect,"btn_b",Bbtn); | |
| 536 | ✗ | zc_set_config(ctrl_sect,"btn_s",Sbtn); | |
| 537 | ✗ | zc_set_config(ctrl_sect,"btn_m",Mbtn); | |
| 538 | ✗ | zc_set_config(ctrl_sect,"btn_l",Lbtn); | |
| 539 | ✗ | zc_set_config(ctrl_sect,"btn_r",Rbtn); | |
| 540 | ✗ | zc_set_config(ctrl_sect,"btn_p",Pbtn); | |
| 541 | ✗ | zc_set_config(ctrl_sect,"btn_ex1",Exbtn1); | |
| 542 | ✗ | zc_set_config(ctrl_sect,"btn_ex2",Exbtn2); | |
| 543 | ✗ | zc_set_config(ctrl_sect,"btn_ex3",Exbtn3); | |
| 544 | ✗ | zc_set_config(ctrl_sect,"btn_ex4",Exbtn4); | |
| 545 | |||
| 546 | ✗ | zc_set_config(ctrl_sect,"btn_up",DUbtn); | |
| 547 | ✗ | zc_set_config(ctrl_sect,"btn_down",DDbtn); | |
| 548 | ✗ | zc_set_config(ctrl_sect,"btn_left",DLbtn); | |
| 549 | ✗ | zc_set_config(ctrl_sect,"btn_right",DRbtn); | |
| 550 | } | ||
| 551 | ✗ | } | |
| 552 | |||
| 553 | ✗ | void save_cheatkeys() | |
| 554 | { | ||
| 555 | char buf[256]; | ||
| 556 | ✗ | for(size_t q = 1; q < Cheat::Last; ++q) | |
| 557 | { | ||
| 558 | ✗ | if(!bindable_cheat((Cheat)q)) continue; | |
| 559 | ✗ | std::string cheatname = cheat_to_string((Cheat)q); | |
| 560 | ✗ | util::lowerstr(cheatname); | |
| 561 | ✗ | sprintf(buf, "key_cheat_%s_main", cheatname.c_str()); | |
| 562 | ✗ | zc_set_config(ctrl_sect,buf,cheatkeys[q][0]); | |
| 563 | ✗ | sprintf(buf, "key_cheat_%s_alt", cheatname.c_str()); | |
| 564 | ✗ | if(cheatkeys[q][1]) | |
| 565 | ✗ | zc_set_config(ctrl_sect,buf,cheatkeys[q][1]); | |
| 566 | ✗ | else zc_set_config(ctrl_sect,buf,(char*)nullptr); | |
| 567 | ✗ | } | |
| 568 | ✗ | } | |
| 569 | |||
| 570 | ✗ | void save_game_configs() | |
| 571 | { | ||
| 572 | ✗ | packfile_password(""); | |
| 573 | |||
| 574 | ✗ | zc_set_config("ZCMODULE",qst_module_name,moduledata.module_name); | |
| 575 | |||
| 576 | ✗ | if (all_get_display() && !all_get_fullscreen_flag()&& SaveWinPos) | |
| 577 | { | ||
| 578 | int o_window_x, o_window_y; | ||
| 579 | ✗ | al_get_window_position(all_get_display(), &o_window_x, &o_window_y); | |
| 580 | ✗ | zc_set_config(cfg_sect,"window_x",o_window_x); | |
| 581 | ✗ | zc_set_config(cfg_sect,"window_y",o_window_y); | |
| 582 | ✗ | } | |
| 583 | |||
| 584 | ✗ | if (all_get_display() && !all_get_fullscreen_flag() && SaveDragResize) | |
| 585 | { | ||
| 586 | ✗ | double monitor_scale = zc_get_monitor_scale(); | |
| 587 | ✗ | window_width = al_get_display_width(all_get_display()) / monitor_scale; | |
| 588 | ✗ | window_height = al_get_display_height(all_get_display()) / monitor_scale; | |
| 589 | ✗ | zc_set_config(cfg_sect,"window_width",window_width); | |
| 590 | ✗ | zc_set_config(cfg_sect,"window_height",window_height); | |
| 591 | ✗ | } | |
| 592 | |||
| 593 | ✗ | zc_set_config(cfg_sect,"load_last",loadlast); | |
| 594 | ✗ | chop_path(qstdir); | |
| 595 | ✗ | zc_set_config(cfg_sect,qst_dir_name,qstdir); | |
| 596 | ✗ | zc_set_config("SAVEFILE","save_filename",save_file_name); | |
| 597 | ✗ | zc_set_config(cfg_sect,"use_sfx_dat",sfxdat); | |
| 598 | |||
| 599 | ✗ | flush_config_file(); | |
| 600 | #ifdef __EMSCRIPTEN__ | ||
| 601 | em_sync_fs(); | ||
| 602 | #endif | ||
| 603 | ✗ | } | |
| 604 | |||
| 605 | //---------------------------------------------------------------- | ||
| 606 | |||
| 607 | // Timers | ||
| 608 | |||
| 609 | 29154 | void fps_callback() | |
| 610 | { | ||
| 611 | 29154 | lastfps=framecnt; | |
| 612 | 29154 | dword tempsecs = fps_secs; | |
| 613 | 29154 | ++tempsecs; | |
| 614 | //avgfps=((long double)avgfps*fps_secs+lastfps)/(++fps_secs); // DJGPP doesn't like this | ||
| 615 | 29154 | avgfps=((long double)avgfps*fps_secs+lastfps)/(tempsecs); | |
| 616 | 29154 | ++fps_secs; | |
| 617 | 29154 | framecnt=0; | |
| 618 | 29154 | } | |
| 619 | |||
| 620 | END_OF_FUNCTION(fps_callback) | ||
| 621 | |||
| 622 | 46 | int32_t Z_init_timers() | |
| 623 | { | ||
| 624 | static bool didit = false; | ||
| 625 | const static char *err_str = "Couldn't allocate timer"; | ||
| 626 | 46 | err_str = err_str; //Unused variable warning | |
| 627 | |||
| 628 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
|
46 | if(didit) |
| 629 | ✗ | return 1; | |
| 630 | |||
| 631 | 46 | didit = true; | |
| 632 | |||
| 633 | LOCK_VARIABLE(lastfps); | ||
| 634 | LOCK_VARIABLE(framecnt); | ||
| 635 | LOCK_FUNCTION(fps_callback); | ||
| 636 | |||
| 637 |
1/2✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
|
46 | if(install_int_ex(fps_callback,SECS_TO_TIMER(1))) |
| 638 | ✗ | return 0; | |
| 639 | |||
| 640 | 46 | return 1; | |
| 641 | 46 | } | |
| 642 | |||
| 643 | ✗ | void Z_remove_timers() | |
| 644 | { | ||
| 645 | ✗ | remove_int(fps_callback); | |
| 646 | ✗ | } | |
| 647 | |||
| 648 | //---------------------------------------------------------------- | ||
| 649 | |||
| 650 | ✗ | void go() | |
| 651 | { | ||
| 652 | ✗ | blit(screen,tmp_scr,scrx,scry,0,0,screen->w,screen->h); | |
| 653 | ✗ | } | |
| 654 | |||
| 655 | ✗ | void comeback() | |
| 656 | { | ||
| 657 | ✗ | blit(tmp_scr,screen,0,0,scrx,scry,screen->w,screen->h); | |
| 658 | ✗ | } | |
| 659 | |||
| 660 | ✗ | void dump_pal(BITMAP *dest) | |
| 661 | { | ||
| 662 | ✗ | for(int32_t i=0; i<256; i++) | |
| 663 | ✗ | rectfill(dest,(i&63)<<2,(i&0xFC0)>>4,((i&63)<<2)+3,((i&0xFC0)>>4)+3,i); | |
| 664 | ✗ | } | |
| 665 | |||
| 666 | //---------------------------------------------------------------- | ||
| 667 | |||
| 668 | int game_mouse_index = ZCM_BLANK; | ||
| 669 | static bool system_mouse = false; | ||
| 670 | 26 | bool sys_mouse() | |
| 671 | { | ||
| 672 | 26 | system_mouse = true; | |
| 673 | 26 | return MouseSprite::set(ZCM_NORMAL); | |
| 674 | } | ||
| 675 | 555 | bool game_mouse() | |
| 676 | { | ||
| 677 | 555 | system_mouse = false; | |
| 678 | 555 | return MouseSprite::set(game_mouse_index); | |
| 679 | } | ||
| 680 | ✗ | void custom_mouse(BITMAP* bmp, int fx, int fy, bool sys_recolor, bool user_scale) | |
| 681 | { | ||
| 682 | ✗ | if(!bmp) | |
| 683 | ✗ | return; | |
| 684 | ✗ | float scale = vbound(zc_get_config("zeldadx","cursor_scale_large",1.5),1.0,5.0); | |
| 685 | ✗ | int scaledw = bmp->w*scale, scaledh = bmp->h*scale; | |
| 686 | ✗ | if(bmp->w == scaledw && bmp->h == scaledh) | |
| 687 | ✗ | user_scale = false; | |
| 688 | ✗ | if(user_scale || sys_recolor) | |
| 689 | { | ||
| 690 | ✗ | if(!user_scale) scale = 1; | |
| 691 | ✗ | BITMAP* tmpbmp = create_bitmap_ex(8,bmp->w*scale,bmp->h*scale); | |
| 692 | ✗ | if(user_scale) | |
| 693 | ✗ | stretch_blit(bmp, tmpbmp, 0, 0, bmp->w, bmp->h, 0, 0, tmpbmp->w, tmpbmp->h); | |
| 694 | else | ||
| 695 | ✗ | blit(bmp, tmpbmp, 0, 0, 0, 0, bmp->w, bmp->h); | |
| 696 | ✗ | if(sys_recolor) | |
| 697 | ✗ | recolor_mouse(tmpbmp); | |
| 698 | ✗ | MouseSprite::assign(ZCM_CUSTOM, tmpbmp, fx*scale, fy*scale); | |
| 699 | ✗ | destroy_bitmap(tmpbmp); | |
| 700 | ✗ | } | |
| 701 | else | ||
| 702 | { | ||
| 703 | ✗ | MouseSprite::assign(ZCM_CUSTOM, bmp, fx, fy); | |
| 704 | } | ||
| 705 | ✗ | } | |
| 706 | |||
| 707 | //Handles converting the mouse sprite from the .dat file | ||
| 708 | ✗ | void recolor_mouse(BITMAP* bmp) | |
| 709 | { | ||
| 710 | ✗ | for(int32_t x = 0; x < bmp->w; ++x) | |
| 711 | { | ||
| 712 | ✗ | for(int32_t y = 0; y < bmp->h; ++y) | |
| 713 | { | ||
| 714 | ✗ | int32_t color = getpixel(bmp, x, y); | |
| 715 | ✗ | switch(color) | |
| 716 | { | ||
| 717 | case dvc(1): | ||
| 718 | ✗ | color = jwin_pal[jcCURSORMISC]; | |
| 719 | ✗ | break; | |
| 720 | case dvc(2): | ||
| 721 | ✗ | color = jwin_pal[jcCURSOROUTLINE]; | |
| 722 | ✗ | break; | |
| 723 | case dvc(3): | ||
| 724 | ✗ | color = jwin_pal[jcCURSORLIGHT]; | |
| 725 | ✗ | break; | |
| 726 | case dvc(5): | ||
| 727 | ✗ | color = jwin_pal[jcCURSORDARK]; | |
| 728 | ✗ | break; | |
| 729 | default: | ||
| 730 | ✗ | continue; | |
| 731 | } | ||
| 732 | ✗ | putpixel(bmp, x, y, color); | |
| 733 | ✗ | } | |
| 734 | ✗ | } | |
| 735 | ✗ | } | |
| 736 | ✗ | void load_mouse() | |
| 737 | { | ||
| 738 | ✗ | enter_sys_pal(); | |
| 739 | ✗ | MouseSprite::set(-1); | |
| 740 | ✗ | float scale = vbound(zc_get_config("zeldadx","cursor_scale_large",1.5),1.0,5.0); | |
| 741 | ✗ | int32_t sz = 16*scale; | |
| 742 | ✗ | for(int32_t j = 0; j < 1; ++j) | |
| 743 | { | ||
| 744 | ✗ | BITMAP* tmpbmp = create_bitmap_ex(8,16,16); | |
| 745 | ✗ | if(zcmouse[j]) | |
| 746 | ✗ | destroy_bitmap(zcmouse[j]); | |
| 747 | ✗ | zcmouse[j] = create_bitmap_ex(8,sz,sz); | |
| 748 | ✗ | clear_bitmap(zcmouse[j]); | |
| 749 | ✗ | clear_bitmap(tmpbmp); | |
| 750 | ✗ | blit((BITMAP*)datafile[BMP_MOUSE].dat,tmpbmp,1,j*17+1,0,0,16,16); | |
| 751 | ✗ | recolor_mouse(tmpbmp); | |
| 752 | ✗ | if(sz!=16) | |
| 753 | ✗ | stretch_blit(tmpbmp, zcmouse[j], 0, 0, 16, 16, 0, 0, sz, sz); | |
| 754 | else | ||
| 755 | ✗ | blit(tmpbmp, zcmouse[j], 0, 0, 0, 0, 16, 16); | |
| 756 | ✗ | destroy_bitmap(tmpbmp); | |
| 757 | ✗ | } | |
| 758 | ✗ | if(!hw_palette) hw_palette = &RAMpal; | |
| 759 | ✗ | zc_set_palette(*hw_palette); | |
| 760 | |||
| 761 | ✗ | BITMAP* blankmouse = create_bitmap_ex(8,16,16); | |
| 762 | ✗ | clear_bitmap(blankmouse); | |
| 763 | |||
| 764 | ✗ | MouseSprite::assign(ZCM_NORMAL, zcmouse[0], 1*scale, 1*scale); | |
| 765 | ✗ | MouseSprite::assign(ZCM_BLANK, blankmouse); | |
| 766 | //Don't assign ZCM_CUSTOM. That'll be handled by scripts. | ||
| 767 | |||
| 768 | //Reload the mouse | ||
| 769 | ✗ | if(system_mouse) | |
| 770 | ✗ | sys_mouse(); | |
| 771 | ✗ | else game_mouse(); | |
| 772 | |||
| 773 | ✗ | destroy_bitmap(blankmouse); | |
| 774 | ✗ | exit_sys_pal(); | |
| 775 | ✗ | } | |
| 776 | |||
| 777 | // sets the video mode and initializes the palette and mouse sprite | ||
| 778 | 46 | bool game_vid_mode(int32_t mode,int32_t wait) | |
| 779 | { | ||
| 780 |
1/2✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
|
46 | if (is_headless()) |
| 781 | 46 | return true; | |
| 782 | |||
| 783 | ✗ | if(set_gfx_mode(mode,resx,resy,0,0)!=0) | |
| 784 | { | ||
| 785 | ✗ | return false; | |
| 786 | } | ||
| 787 | |||
| 788 | ✗ | scrx = (resx-320)>>1; | |
| 789 | ✗ | scry = (resy-240)>>1; | |
| 790 | ✗ | for(int32_t q = 0; q < NUM_ZCMOUSE; ++q) | |
| 791 | ✗ | zcmouse[q] = NULL; | |
| 792 | ✗ | load_mouse(); | |
| 793 | |||
| 794 | ✗ | for(int32_t i=240; i<256; i++) | |
| 795 | ✗ | RAMpal[i]=((RGB*)datafile[PAL_GUI].dat)[i]; | |
| 796 | |||
| 797 | ✗ | zc_set_palette(RAMpal); | |
| 798 | ✗ | clear_to_color(screen,BLACK); | |
| 799 | |||
| 800 | ✗ | rest(wait); | |
| 801 | ✗ | return true; | |
| 802 | 46 | } | |
| 803 | |||
| 804 | 8 | void null_quest() | |
| 805 | { | ||
| 806 | char qstdat_string[2048]; | ||
| 807 | 8 | strcpy(qstdat_string, "modules/classic/default.qst"); | |
| 808 | |||
| 809 | #ifdef __EMSCRIPTEN__ | ||
| 810 | // The quest template data file is not included because it's really big and isn't really needed | ||
| 811 | // for the player, except to initialize some graphics. Those same graphics exist in this quest file, | ||
| 812 | // which is much smaller. | ||
| 813 | strcpy(qstdat_string, "modules/classic/title_gfx.dat"); | ||
| 814 | #endif | ||
| 815 | |||
| 816 | 8 | byte skip_flags[4] = { 0 }; | |
| 817 | |||
| 818 | 8 | loadquest(qstdat_string,&QHeader,&QMisc,tunes+ZC_MIDI_COUNT,false,skip_flags,0,false); | |
| 819 | 8 | } | |
| 820 | |||
| 821 | // TODO remove | ||
| 822 | 8 | void init_NES_mode() | |
| 823 | { | ||
| 824 | 8 | null_quest(); | |
| 825 | 8 | } | |
| 826 | |||
| 827 | //---------------------------------------------------------------- | ||
| 828 | |||
| 829 | qword trianglelines[16]= | ||
| 830 | { | ||
| 831 | 0x0000000000000000ULL, | ||
| 832 | 0xFD00000000000000ULL, | ||
| 833 | 0xFDFD000000000000ULL, | ||
| 834 | 0xFDFDFD0000000000ULL, | ||
| 835 | 0xFDFDFDFD00000000ULL, | ||
| 836 | 0xFDFDFDFDFD000000ULL, | ||
| 837 | 0xFDFDFDFDFDFD0000ULL, | ||
| 838 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 839 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 840 | 0x00FDFDFDFDFDFDFDULL, | ||
| 841 | 0x0000FDFDFDFDFDFDULL, | ||
| 842 | 0x000000FDFDFDFDFDULL, | ||
| 843 | 0x00000000FDFDFDFDULL, | ||
| 844 | 0x0000000000FDFDFDULL, | ||
| 845 | 0x000000000000FDFDULL, | ||
| 846 | 0x00000000000000FDULL, | ||
| 847 | }; | ||
| 848 | |||
| 849 | word screen_triangles[28][32]; | ||
| 850 | /* | ||
| 851 | qword triangles[4][16]= //[direction][value] | ||
| 852 | { | ||
| 853 | { | ||
| 854 | 0x00000000, 0x10000000, 0x21000000, 0x32100000, 0x43210000, 0x54321000, 0x65432100, 0x76543210, 0x87654321, 0x88765432, 0x88876543, 0x88887654, 0x88888765, 0x88888876, 0x88888887, 0x88888888 | ||
| 855 | }, | ||
| 856 | { | ||
| 857 | 0x00000000, 0xF0000000, 0xEF000000, 0xFDF00000, 0xCFDF0000, 0xBCFDF000, 0xABCFDF00, 0x9ABCFDF0, 0x89ABCFDF, 0x889ABCFD, 0x8889ABCD, 0x88889ABC, 0x888889AB, 0x8888889A, 0x88888889, 0x88888888 | ||
| 858 | }, | ||
| 859 | { | ||
| 860 | 0x00000000, 0x00000001, 0x00000012, 0x00000123, 0x00001234, 0x00012345, 0x00123456, 0x01234567, 0x12345678, 0x23456788, 0x34567888, 0x45678888, 0x56788888, 0x67888888, 0x78888888, 0x88888888 | ||
| 861 | }, | ||
| 862 | { | ||
| 863 | 0x00000000, 0x0000000F, 0x000000FE, 0x00000FED, 0x0000FEDC, 0x000FEDCB, 0x00FEDCBA, 0x0FEDCBA9, 0xFEDCBA98, 0xEDCBA988, 0xDCBA9888, 0xCBA98888, 0xBA988888, 0xA9888888, 0x98888888, 0x88888888 | ||
| 864 | } | ||
| 865 | }; | ||
| 866 | */ | ||
| 867 | |||
| 868 | |||
| 869 | /* | ||
| 870 | byte triangles[4][16][8]= //[direction][value][line] | ||
| 871 | { | ||
| 872 | { | ||
| 873 | { | ||
| 874 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
| 875 | }, | ||
| 876 | { | ||
| 877 | 1, 0, 0, 0, 0, 0, 0, 0 | ||
| 878 | }, | ||
| 879 | { | ||
| 880 | 2, 1, 0, 0, 0, 0, 0, 0 | ||
| 881 | }, | ||
| 882 | { | ||
| 883 | 3, 2, 1, 0, 0, 0, 0, 0 | ||
| 884 | }, | ||
| 885 | { | ||
| 886 | 4, 3, 2, 1, 0, 0, 0, 0 | ||
| 887 | }, | ||
| 888 | { | ||
| 889 | 5, 4, 3, 2, 1, 0, 0, 0 | ||
| 890 | }, | ||
| 891 | { | ||
| 892 | 6, 5, 4, 3, 2, 1, 0, 0 | ||
| 893 | }, | ||
| 894 | { | ||
| 895 | 7, 6, 5, 4, 3, 2, 1, 0 | ||
| 896 | }, | ||
| 897 | { | ||
| 898 | 8, 7, 6, 5, 4, 3, 2, 1 | ||
| 899 | }, | ||
| 900 | { | ||
| 901 | 8, 8, 7, 6, 5, 4, 3, 2 | ||
| 902 | }, | ||
| 903 | { | ||
| 904 | 8, 8, 8, 7, 6, 5, 4, 3 | ||
| 905 | }, | ||
| 906 | { | ||
| 907 | 8, 8, 8, 8, 7, 6, 5, 4 | ||
| 908 | }, | ||
| 909 | { | ||
| 910 | 8, 8, 8, 8, 8, 7, 6, 5 | ||
| 911 | }, | ||
| 912 | { | ||
| 913 | 8, 8, 8, 8, 8, 8, 7, 6 | ||
| 914 | }, | ||
| 915 | { | ||
| 916 | 8, 8, 8, 8, 8, 8, 8, 7 | ||
| 917 | }, | ||
| 918 | { | ||
| 919 | 8, 8, 8, 8, 8, 8, 8, 8 | ||
| 920 | } | ||
| 921 | }, | ||
| 922 | { | ||
| 923 | { | ||
| 924 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
| 925 | }, | ||
| 926 | { | ||
| 927 | 15, 0, 0, 0, 0, 0, 0, 0 | ||
| 928 | }, | ||
| 929 | { | ||
| 930 | 14, 15, 0, 0, 0, 0, 0, 0 | ||
| 931 | }, | ||
| 932 | { | ||
| 933 | 13, 14, 15, 0, 0, 0, 0, 0 | ||
| 934 | }, | ||
| 935 | { | ||
| 936 | 12, 13, 14, 15, 0, 0, 0, 0 | ||
| 937 | }, | ||
| 938 | { | ||
| 939 | 11, 12, 13, 14, 15, 0, 0, 0 | ||
| 940 | }, | ||
| 941 | { | ||
| 942 | 10, 11, 12, 13, 14, 15, 0, 0 | ||
| 943 | }, | ||
| 944 | { | ||
| 945 | 9, 10, 11, 12, 13, 14, 15, 0 | ||
| 946 | }, | ||
| 947 | { | ||
| 948 | 8, 9, 10, 11, 12, 13, 14, 15 | ||
| 949 | }, | ||
| 950 | { | ||
| 951 | 8, 8, 9, 10, 11, 12, 13, 14 | ||
| 952 | }, | ||
| 953 | { | ||
| 954 | 8, 8, 8, 9, 10, 11, 12, 13 | ||
| 955 | }, | ||
| 956 | { | ||
| 957 | 8, 8, 8, 8, 9, 10, 11, 12 | ||
| 958 | }, | ||
| 959 | { | ||
| 960 | 8, 8, 8, 8, 8, 9, 10, 11 | ||
| 961 | }, | ||
| 962 | { | ||
| 963 | 8, 8, 8, 8, 8, 8, 9, 10 | ||
| 964 | }, | ||
| 965 | { | ||
| 966 | 8, 8, 8, 8, 8, 8, 8, 9 | ||
| 967 | }, | ||
| 968 | { | ||
| 969 | 8, 8, 8, 8, 8, 8, 8, 8 | ||
| 970 | } | ||
| 971 | }, | ||
| 972 | { | ||
| 973 | { | ||
| 974 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
| 975 | }, | ||
| 976 | { | ||
| 977 | 0, 0, 0, 0, 0, 0, 0, 1 | ||
| 978 | }, | ||
| 979 | { | ||
| 980 | 0, 0, 0, 0, 0, 0, 1, 2 | ||
| 981 | }, | ||
| 982 | { | ||
| 983 | 0, 0, 0, 0, 0, 1, 2, 3 | ||
| 984 | }, | ||
| 985 | { | ||
| 986 | 0, 0, 0, 0, 1, 2, 3, 4 | ||
| 987 | }, | ||
| 988 | { | ||
| 989 | 0, 0, 0, 1, 2, 3, 4, 5 | ||
| 990 | }, | ||
| 991 | { | ||
| 992 | 0, 0, 1, 2, 3, 4, 5, 6 | ||
| 993 | }, | ||
| 994 | { | ||
| 995 | 0, 1, 2, 3, 4, 5, 6, 7 | ||
| 996 | }, | ||
| 997 | { | ||
| 998 | 1, 2, 3, 4, 5, 6, 7, 8 | ||
| 999 | }, | ||
| 1000 | { | ||
| 1001 | 2, 3, 4, 5, 6, 7, 8, 8 | ||
| 1002 | }, | ||
| 1003 | { | ||
| 1004 | 3, 4, 5, 6, 7, 8, 8, 8 | ||
| 1005 | }, | ||
| 1006 | { | ||
| 1007 | 4, 5, 6, 7, 8, 8, 8, 8 | ||
| 1008 | }, | ||
| 1009 | { | ||
| 1010 | 5, 6, 7, 8, 8, 8, 8, 8 | ||
| 1011 | }, | ||
| 1012 | { | ||
| 1013 | 6, 7, 8, 8, 8, 8, 8, 8 | ||
| 1014 | }, | ||
| 1015 | { | ||
| 1016 | 7, 8, 8, 8, 8, 8, 8, 8 | ||
| 1017 | }, | ||
| 1018 | { | ||
| 1019 | 8, 8, 8, 8, 8, 8, 8, 8 | ||
| 1020 | } | ||
| 1021 | }, | ||
| 1022 | { | ||
| 1023 | { | ||
| 1024 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
| 1025 | }, | ||
| 1026 | { | ||
| 1027 | 0, 0, 0, 0, 0, 0, 0, 15 | ||
| 1028 | }, | ||
| 1029 | { | ||
| 1030 | 0, 0, 0, 0, 0, 0, 15, 14 | ||
| 1031 | }, | ||
| 1032 | { | ||
| 1033 | 0, 0, 0, 0, 0, 15, 14, 13 | ||
| 1034 | }, | ||
| 1035 | { | ||
| 1036 | 0, 0, 0, 0, 15, 14, 13, 12 | ||
| 1037 | }, | ||
| 1038 | { | ||
| 1039 | 0, 0, 0, 15, 14, 13, 12, 11 | ||
| 1040 | }, | ||
| 1041 | { | ||
| 1042 | 0, 0, 15, 14, 13, 12, 11, 10 | ||
| 1043 | }, | ||
| 1044 | { | ||
| 1045 | 0, 15, 14, 13, 12, 11, 10, 9 | ||
| 1046 | }, | ||
| 1047 | { | ||
| 1048 | 15, 14, 13, 12, 11, 10, 9, 8 | ||
| 1049 | }, | ||
| 1050 | { | ||
| 1051 | 14, 13, 12, 11, 10, 9, 8, 8 | ||
| 1052 | }, | ||
| 1053 | { | ||
| 1054 | 13, 12, 11, 10, 9, 8, 8, 8 | ||
| 1055 | }, | ||
| 1056 | { | ||
| 1057 | 12, 11, 10, 9, 8, 8, 8, 8 | ||
| 1058 | }, | ||
| 1059 | { | ||
| 1060 | 11, 10, 9, 8, 8, 8, 8, 8 | ||
| 1061 | }, | ||
| 1062 | { | ||
| 1063 | 10, 9, 8, 8, 8, 8, 8, 8 | ||
| 1064 | }, | ||
| 1065 | { | ||
| 1066 | 9, 8, 8, 8, 8, 8, 8, 8 | ||
| 1067 | }, | ||
| 1068 | { | ||
| 1069 | 8, 8, 8, 8, 8, 8, 8, 8 | ||
| 1070 | } | ||
| 1071 | } | ||
| 1072 | }; | ||
| 1073 | */ | ||
| 1074 | |||
| 1075 | |||
| 1076 | |||
| 1077 | /* | ||
| 1078 | for (int32_t blockrow=0; blockrow<30; ++i) | ||
| 1079 | { | ||
| 1080 | for (int32_t linerow=0; linerow<8; ++i) | ||
| 1081 | { | ||
| 1082 | qword *triangleline=(qword*)(tmp_scr->line[(blockrow*8+linerow)]); | ||
| 1083 | for (int32_t blockcolumn=0; blockcolumn<40; ++i) | ||
| 1084 | { | ||
| 1085 | triangleline=triangles[0][screen_triangles[blockrow][blockcolumn]][linerow]; | ||
| 1086 | ++triangleline; | ||
| 1087 | } | ||
| 1088 | } | ||
| 1089 | } | ||
| 1090 | */ | ||
| 1091 | |||
| 1092 | // the ULL suffixes are to prevent this warning: | ||
| 1093 | // warning: integer constant is too large for "int32_t" type | ||
| 1094 | |||
| 1095 | qword triangles[4][16][8]= //[direction][value][line] | ||
| 1096 | { | ||
| 1097 | { | ||
| 1098 | { | ||
| 1099 | 0x0000000000000000ULL, | ||
| 1100 | 0x0000000000000000ULL, | ||
| 1101 | 0x0000000000000000ULL, | ||
| 1102 | 0x0000000000000000ULL, | ||
| 1103 | 0x0000000000000000ULL, | ||
| 1104 | 0x0000000000000000ULL, | ||
| 1105 | 0x0000000000000000ULL, | ||
| 1106 | 0x0000000000000000ULL | ||
| 1107 | }, | ||
| 1108 | { | ||
| 1109 | 0xFD00000000000000ULL, | ||
| 1110 | 0x0000000000000000ULL, | ||
| 1111 | 0x0000000000000000ULL, | ||
| 1112 | 0x0000000000000000ULL, | ||
| 1113 | 0x0000000000000000ULL, | ||
| 1114 | 0x0000000000000000ULL, | ||
| 1115 | 0x0000000000000000ULL, | ||
| 1116 | 0x0000000000000000ULL | ||
| 1117 | }, | ||
| 1118 | { | ||
| 1119 | 0xFDFD000000000000ULL, | ||
| 1120 | 0xFD00000000000000ULL, | ||
| 1121 | 0x0000000000000000ULL, | ||
| 1122 | 0x0000000000000000ULL, | ||
| 1123 | 0x0000000000000000ULL, | ||
| 1124 | 0x0000000000000000ULL, | ||
| 1125 | 0x0000000000000000ULL, | ||
| 1126 | 0x0000000000000000ULL | ||
| 1127 | }, | ||
| 1128 | { | ||
| 1129 | 0xFDFDFD0000000000ULL, | ||
| 1130 | 0xFDFD000000000000ULL, | ||
| 1131 | 0xFD00000000000000ULL, | ||
| 1132 | 0x0000000000000000ULL, | ||
| 1133 | 0x0000000000000000ULL, | ||
| 1134 | 0x0000000000000000ULL, | ||
| 1135 | 0x0000000000000000ULL, | ||
| 1136 | 0x0000000000000000ULL | ||
| 1137 | }, | ||
| 1138 | { | ||
| 1139 | 0xFDFDFDFD00000000ULL, | ||
| 1140 | 0xFDFDFD0000000000ULL, | ||
| 1141 | 0xFDFD000000000000ULL, | ||
| 1142 | 0xFD00000000000000ULL, | ||
| 1143 | 0x0000000000000000ULL, | ||
| 1144 | 0x0000000000000000ULL, | ||
| 1145 | 0x0000000000000000ULL, | ||
| 1146 | 0x0000000000000000ULL | ||
| 1147 | }, | ||
| 1148 | { | ||
| 1149 | 0xFDFDFDFDFD000000ULL, | ||
| 1150 | 0xFDFDFDFD00000000ULL, | ||
| 1151 | 0xFDFDFD0000000000ULL, | ||
| 1152 | 0xFDFD000000000000ULL, | ||
| 1153 | 0xFD00000000000000ULL, | ||
| 1154 | 0x0000000000000000ULL, | ||
| 1155 | 0x0000000000000000ULL, | ||
| 1156 | 0x0000000000000000ULL | ||
| 1157 | }, | ||
| 1158 | { | ||
| 1159 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1160 | 0xFDFDFDFDFD000000ULL, | ||
| 1161 | 0xFDFDFDFD00000000ULL, | ||
| 1162 | 0xFDFDFD0000000000ULL, | ||
| 1163 | 0xFDFD000000000000ULL, | ||
| 1164 | 0xFD00000000000000ULL, | ||
| 1165 | 0x0000000000000000ULL, | ||
| 1166 | 0x0000000000000000ULL | ||
| 1167 | }, | ||
| 1168 | { | ||
| 1169 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1170 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1171 | 0xFDFDFDFDFD000000ULL, | ||
| 1172 | 0xFDFDFDFD00000000ULL, | ||
| 1173 | 0xFDFDFD0000000000ULL, | ||
| 1174 | 0xFDFD000000000000ULL, | ||
| 1175 | 0xFD00000000000000ULL, | ||
| 1176 | 0x0000000000000000ULL | ||
| 1177 | }, | ||
| 1178 | { | ||
| 1179 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1180 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1181 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1182 | 0xFDFDFDFDFD000000ULL, | ||
| 1183 | 0xFDFDFDFD00000000ULL, | ||
| 1184 | 0xFDFDFD0000000000ULL, | ||
| 1185 | 0xFDFD000000000000ULL, | ||
| 1186 | 0xFD00000000000000ULL | ||
| 1187 | }, | ||
| 1188 | { | ||
| 1189 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1190 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1191 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1192 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1193 | 0xFDFDFDFDFD000000ULL, | ||
| 1194 | 0xFDFDFDFD00000000ULL, | ||
| 1195 | 0xFDFDFD0000000000ULL, | ||
| 1196 | 0xFDFD000000000000ULL | ||
| 1197 | }, | ||
| 1198 | { | ||
| 1199 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1200 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1201 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1202 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1203 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1204 | 0xFDFDFDFDFD000000ULL, | ||
| 1205 | 0xFDFDFDFD00000000ULL, | ||
| 1206 | 0xFDFDFD0000000000ULL | ||
| 1207 | }, | ||
| 1208 | { | ||
| 1209 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1210 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1211 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1212 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1213 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1214 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1215 | 0xFDFDFDFDFD000000ULL, | ||
| 1216 | 0xFDFDFDFD00000000ULL | ||
| 1217 | }, | ||
| 1218 | { | ||
| 1219 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1220 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1221 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1222 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1223 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1224 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1225 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1226 | 0xFDFDFDFDFD000000ULL | ||
| 1227 | }, | ||
| 1228 | { | ||
| 1229 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1230 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1231 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1232 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1233 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1234 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1235 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1236 | 0xFDFDFDFDFDFD0000ULL | ||
| 1237 | }, | ||
| 1238 | { | ||
| 1239 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1240 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1241 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1242 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1243 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1244 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1245 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1246 | 0xFDFDFDFDFDFDFD00ULL | ||
| 1247 | }, | ||
| 1248 | { | ||
| 1249 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1250 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1251 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1252 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1253 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1254 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1255 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1256 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1257 | } | ||
| 1258 | }, | ||
| 1259 | { | ||
| 1260 | { | ||
| 1261 | 0x0000000000000000ULL, | ||
| 1262 | 0x0000000000000000ULL, | ||
| 1263 | 0x0000000000000000ULL, | ||
| 1264 | 0x0000000000000000ULL, | ||
| 1265 | 0x0000000000000000ULL, | ||
| 1266 | 0x0000000000000000ULL, | ||
| 1267 | 0x0000000000000000ULL, | ||
| 1268 | 0x0000000000000000ULL | ||
| 1269 | }, | ||
| 1270 | { | ||
| 1271 | 0x00000000000000FDULL, | ||
| 1272 | 0x0000000000000000ULL, | ||
| 1273 | 0x0000000000000000ULL, | ||
| 1274 | 0x0000000000000000ULL, | ||
| 1275 | 0x0000000000000000ULL, | ||
| 1276 | 0x0000000000000000ULL, | ||
| 1277 | 0x0000000000000000ULL, | ||
| 1278 | 0x0000000000000000ULL | ||
| 1279 | }, | ||
| 1280 | { | ||
| 1281 | 0x000000000000FDFDULL, | ||
| 1282 | 0x00000000000000FDULL, | ||
| 1283 | 0x0000000000000000ULL, | ||
| 1284 | 0x0000000000000000ULL, | ||
| 1285 | 0x0000000000000000ULL, | ||
| 1286 | 0x0000000000000000ULL, | ||
| 1287 | 0x0000000000000000ULL, | ||
| 1288 | 0x0000000000000000ULL | ||
| 1289 | }, | ||
| 1290 | { | ||
| 1291 | 0x0000000000FDFDFDULL, | ||
| 1292 | 0x000000000000FDFDULL, | ||
| 1293 | 0x00000000000000FDULL, | ||
| 1294 | 0x0000000000000000ULL, | ||
| 1295 | 0x0000000000000000ULL, | ||
| 1296 | 0x0000000000000000ULL, | ||
| 1297 | 0x0000000000000000ULL, | ||
| 1298 | 0x0000000000000000ULL | ||
| 1299 | }, | ||
| 1300 | { | ||
| 1301 | 0x00000000FDFDFDFDULL, | ||
| 1302 | 0x0000000000FDFDFDULL, | ||
| 1303 | 0x000000000000FDFDULL, | ||
| 1304 | 0x00000000000000FDULL, | ||
| 1305 | 0x0000000000000000ULL, | ||
| 1306 | 0x0000000000000000ULL, | ||
| 1307 | 0x0000000000000000ULL, | ||
| 1308 | 0x0000000000000000ULL | ||
| 1309 | }, | ||
| 1310 | { | ||
| 1311 | 0x000000FDFDFDFDFDULL, | ||
| 1312 | 0x00000000FDFDFDFDULL, | ||
| 1313 | 0x0000000000FDFDFDULL, | ||
| 1314 | 0x000000000000FDFDULL, | ||
| 1315 | 0x00000000000000FDULL, | ||
| 1316 | 0x0000000000000000ULL, | ||
| 1317 | 0x0000000000000000ULL, | ||
| 1318 | 0x0000000000000000ULL | ||
| 1319 | }, | ||
| 1320 | { | ||
| 1321 | 0x0000FDFDFDFDFDFDULL, | ||
| 1322 | 0x000000FDFDFDFDFDULL, | ||
| 1323 | 0x00000000FDFDFDFDULL, | ||
| 1324 | 0x0000000000FDFDFDULL, | ||
| 1325 | 0x000000000000FDFDULL, | ||
| 1326 | 0x00000000000000FDULL, | ||
| 1327 | 0x0000000000000000ULL, | ||
| 1328 | 0x0000000000000000ULL | ||
| 1329 | }, | ||
| 1330 | { | ||
| 1331 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1332 | 0x0000FDFDFDFDFDFDULL, | ||
| 1333 | 0x000000FDFDFDFDFDULL, | ||
| 1334 | 0x00000000FDFDFDFDULL, | ||
| 1335 | 0x0000000000FDFDFDULL, | ||
| 1336 | 0x000000000000FDFDULL, | ||
| 1337 | 0x00000000000000FDULL, | ||
| 1338 | 0x0000000000000000ULL | ||
| 1339 | }, | ||
| 1340 | { | ||
| 1341 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1342 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1343 | 0x0000FDFDFDFDFDFDULL, | ||
| 1344 | 0x000000FDFDFDFDFDULL, | ||
| 1345 | 0x00000000FDFDFDFDULL, | ||
| 1346 | 0x0000000000FDFDFDULL, | ||
| 1347 | 0x000000000000FDFDULL, | ||
| 1348 | 0x00000000000000FDULL | ||
| 1349 | }, | ||
| 1350 | { | ||
| 1351 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1352 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1353 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1354 | 0x0000FDFDFDFDFDFDULL, | ||
| 1355 | 0x000000FDFDFDFDFDULL, | ||
| 1356 | 0x00000000FDFDFDFDULL, | ||
| 1357 | 0x0000000000FDFDFDULL, | ||
| 1358 | 0x000000000000FDFDULL | ||
| 1359 | }, | ||
| 1360 | { | ||
| 1361 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1362 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1363 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1364 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1365 | 0x0000FDFDFDFDFDFDULL, | ||
| 1366 | 0x000000FDFDFDFDFDULL, | ||
| 1367 | 0x00000000FDFDFDFDULL, | ||
| 1368 | 0x0000000000FDFDFDULL | ||
| 1369 | }, | ||
| 1370 | { | ||
| 1371 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1372 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1373 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1374 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1375 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1376 | 0x0000FDFDFDFDFDFDULL, | ||
| 1377 | 0x000000FDFDFDFDFDULL, | ||
| 1378 | 0x00000000FDFDFDFDULL | ||
| 1379 | }, | ||
| 1380 | { | ||
| 1381 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1382 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1383 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1384 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1385 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1386 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1387 | 0x0000FDFDFDFDFDFDULL, | ||
| 1388 | 0x000000FDFDFDFDFDULL | ||
| 1389 | }, | ||
| 1390 | { | ||
| 1391 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1392 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1393 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1394 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1395 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1396 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1397 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1398 | 0x0000FDFDFDFDFDFDULL | ||
| 1399 | }, | ||
| 1400 | { | ||
| 1401 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1402 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1403 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1404 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1405 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1406 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1407 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1408 | 0x00FDFDFDFDFDFDFDULL | ||
| 1409 | }, | ||
| 1410 | { | ||
| 1411 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1412 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1413 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1414 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1415 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1416 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1417 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1418 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1419 | } | ||
| 1420 | }, | ||
| 1421 | { | ||
| 1422 | { | ||
| 1423 | 0x0000000000000000ULL, | ||
| 1424 | 0x0000000000000000ULL, | ||
| 1425 | 0x0000000000000000ULL, | ||
| 1426 | 0x0000000000000000ULL, | ||
| 1427 | 0x0000000000000000ULL, | ||
| 1428 | 0x0000000000000000ULL, | ||
| 1429 | 0x0000000000000000ULL, | ||
| 1430 | 0x0000000000000000ULL | ||
| 1431 | }, | ||
| 1432 | { | ||
| 1433 | 0x0000000000000000ULL, | ||
| 1434 | 0x0000000000000000ULL, | ||
| 1435 | 0x0000000000000000ULL, | ||
| 1436 | 0x0000000000000000ULL, | ||
| 1437 | 0x0000000000000000ULL, | ||
| 1438 | 0x0000000000000000ULL, | ||
| 1439 | 0x0000000000000000ULL, | ||
| 1440 | 0xFD00000000000000ULL | ||
| 1441 | }, | ||
| 1442 | { | ||
| 1443 | 0x0000000000000000ULL, | ||
| 1444 | 0x0000000000000000ULL, | ||
| 1445 | 0x0000000000000000ULL, | ||
| 1446 | 0x0000000000000000ULL, | ||
| 1447 | 0x0000000000000000ULL, | ||
| 1448 | 0x0000000000000000ULL, | ||
| 1449 | 0xFD00000000000000ULL, | ||
| 1450 | 0xFDFD000000000000ULL | ||
| 1451 | }, | ||
| 1452 | { | ||
| 1453 | 0x0000000000000000ULL, | ||
| 1454 | 0x0000000000000000ULL, | ||
| 1455 | 0x0000000000000000ULL, | ||
| 1456 | 0x0000000000000000ULL, | ||
| 1457 | 0x0000000000000000ULL, | ||
| 1458 | 0xFD00000000000000ULL, | ||
| 1459 | 0xFDFD000000000000ULL, | ||
| 1460 | 0xFDFDFD0000000000ULL | ||
| 1461 | }, | ||
| 1462 | { | ||
| 1463 | 0x0000000000000000ULL, | ||
| 1464 | 0x0000000000000000ULL, | ||
| 1465 | 0x0000000000000000ULL, | ||
| 1466 | 0x0000000000000000ULL, | ||
| 1467 | 0xFD00000000000000ULL, | ||
| 1468 | 0xFDFD000000000000ULL, | ||
| 1469 | 0xFDFDFD0000000000ULL, | ||
| 1470 | 0xFDFDFDFD00000000ULL | ||
| 1471 | }, | ||
| 1472 | { | ||
| 1473 | 0x0000000000000000ULL, | ||
| 1474 | 0x0000000000000000ULL, | ||
| 1475 | 0x0000000000000000ULL, | ||
| 1476 | 0xFD00000000000000ULL, | ||
| 1477 | 0xFDFD000000000000ULL, | ||
| 1478 | 0xFDFDFD0000000000ULL, | ||
| 1479 | 0xFDFDFDFD00000000ULL, | ||
| 1480 | 0xFDFDFDFDFD000000ULL | ||
| 1481 | }, | ||
| 1482 | { | ||
| 1483 | 0x0000000000000000ULL, | ||
| 1484 | 0x0000000000000000ULL, | ||
| 1485 | 0xFD00000000000000ULL, | ||
| 1486 | 0xFDFD000000000000ULL, | ||
| 1487 | 0xFDFDFD0000000000ULL, | ||
| 1488 | 0xFDFDFDFD00000000ULL, | ||
| 1489 | 0xFDFDFDFDFD000000ULL, | ||
| 1490 | 0xFDFDFDFDFDFD0000ULL | ||
| 1491 | }, | ||
| 1492 | { | ||
| 1493 | 0x0000000000000000ULL, | ||
| 1494 | 0xFD00000000000000ULL, | ||
| 1495 | 0xFDFD000000000000ULL, | ||
| 1496 | 0xFDFDFD0000000000ULL, | ||
| 1497 | 0xFDFDFDFD00000000ULL, | ||
| 1498 | 0xFDFDFDFDFD000000ULL, | ||
| 1499 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1500 | 0xFDFDFDFDFDFDFD00ULL | ||
| 1501 | }, | ||
| 1502 | { | ||
| 1503 | 0xFD00000000000000ULL, | ||
| 1504 | 0xFDFD000000000000ULL, | ||
| 1505 | 0xFDFDFD0000000000ULL, | ||
| 1506 | 0xFDFDFDFD00000000ULL, | ||
| 1507 | 0xFDFDFDFDFD000000ULL, | ||
| 1508 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1509 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1510 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1511 | }, | ||
| 1512 | { | ||
| 1513 | 0xFDFD000000000000ULL, | ||
| 1514 | 0xFDFDFD0000000000ULL, | ||
| 1515 | 0xFDFDFDFD00000000ULL, | ||
| 1516 | 0xFDFDFDFDFD000000ULL, | ||
| 1517 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1518 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1519 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1520 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1521 | }, | ||
| 1522 | { | ||
| 1523 | 0xFDFDFD0000000000ULL, | ||
| 1524 | 0xFDFDFDFD00000000ULL, | ||
| 1525 | 0xFDFDFDFDFD000000ULL, | ||
| 1526 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1527 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1528 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1529 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1530 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1531 | }, | ||
| 1532 | { | ||
| 1533 | 0xFDFDFDFD00000000ULL, | ||
| 1534 | 0xFDFDFDFDFD000000ULL, | ||
| 1535 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1536 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1537 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1538 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1539 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1540 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1541 | }, | ||
| 1542 | { | ||
| 1543 | 0xFDFDFDFDFD000000ULL, | ||
| 1544 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1545 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1546 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1547 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1548 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1549 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1550 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1551 | }, | ||
| 1552 | { | ||
| 1553 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1554 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1555 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1556 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1557 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1558 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1559 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1560 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1561 | }, | ||
| 1562 | { | ||
| 1563 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1564 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1565 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1566 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1567 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1568 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1569 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1570 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1571 | }, | ||
| 1572 | { | ||
| 1573 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1574 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1575 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1576 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1577 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1578 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1579 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1580 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1581 | } | ||
| 1582 | }, | ||
| 1583 | { | ||
| 1584 | { | ||
| 1585 | 0x0000000000000000ULL, | ||
| 1586 | 0x0000000000000000ULL, | ||
| 1587 | 0x0000000000000000ULL, | ||
| 1588 | 0x0000000000000000ULL, | ||
| 1589 | 0x0000000000000000ULL, | ||
| 1590 | 0x0000000000000000ULL, | ||
| 1591 | 0x0000000000000000ULL, | ||
| 1592 | 0x0000000000000000ULL | ||
| 1593 | }, | ||
| 1594 | { | ||
| 1595 | 0x0000000000000000ULL, | ||
| 1596 | 0x0000000000000000ULL, | ||
| 1597 | 0x0000000000000000ULL, | ||
| 1598 | 0x0000000000000000ULL, | ||
| 1599 | 0x0000000000000000ULL, | ||
| 1600 | 0x0000000000000000ULL, | ||
| 1601 | 0x0000000000000000ULL, | ||
| 1602 | 0x00000000000000FDULL | ||
| 1603 | }, | ||
| 1604 | { | ||
| 1605 | 0x0000000000000000ULL, | ||
| 1606 | 0x0000000000000000ULL, | ||
| 1607 | 0x0000000000000000ULL, | ||
| 1608 | 0x0000000000000000ULL, | ||
| 1609 | 0x0000000000000000ULL, | ||
| 1610 | 0x0000000000000000ULL, | ||
| 1611 | 0x00000000000000FDULL, | ||
| 1612 | 0x000000000000FDFDULL | ||
| 1613 | }, | ||
| 1614 | { | ||
| 1615 | 0x0000000000000000ULL, | ||
| 1616 | 0x0000000000000000ULL, | ||
| 1617 | 0x0000000000000000ULL, | ||
| 1618 | 0x0000000000000000ULL, | ||
| 1619 | 0x0000000000000000ULL, | ||
| 1620 | 0x00000000000000FDULL, | ||
| 1621 | 0x000000000000FDFDULL, | ||
| 1622 | 0x0000000000FDFDFDULL | ||
| 1623 | }, | ||
| 1624 | { | ||
| 1625 | 0x0000000000000000ULL, | ||
| 1626 | 0x0000000000000000ULL, | ||
| 1627 | 0x0000000000000000ULL, | ||
| 1628 | 0x0000000000000000ULL, | ||
| 1629 | 0x00000000000000FDULL, | ||
| 1630 | 0x000000000000FDFDULL, | ||
| 1631 | 0x0000000000FDFDFDULL, | ||
| 1632 | 0x00000000FDFDFDFDULL | ||
| 1633 | }, | ||
| 1634 | { | ||
| 1635 | 0x0000000000000000ULL, | ||
| 1636 | 0x0000000000000000ULL, | ||
| 1637 | 0x0000000000000000ULL, | ||
| 1638 | 0x00000000000000FDULL, | ||
| 1639 | 0x000000000000FDFDULL, | ||
| 1640 | 0x0000000000FDFDFDULL, | ||
| 1641 | 0x00000000FDFDFDFDULL, | ||
| 1642 | 0x000000FDFDFDFDFDULL | ||
| 1643 | }, | ||
| 1644 | { | ||
| 1645 | 0x0000000000000000ULL, | ||
| 1646 | 0x0000000000000000ULL, | ||
| 1647 | 0x00000000000000FDULL, | ||
| 1648 | 0x000000000000FDFDULL, | ||
| 1649 | 0x0000000000FDFDFDULL, | ||
| 1650 | 0x00000000FDFDFDFDULL, | ||
| 1651 | 0x000000FDFDFDFDFDULL, | ||
| 1652 | 0x0000FDFDFDFDFDFDULL | ||
| 1653 | }, | ||
| 1654 | { | ||
| 1655 | 0x0000000000000000ULL, | ||
| 1656 | 0x00000000000000FDULL, | ||
| 1657 | 0x000000000000FDFDULL, | ||
| 1658 | 0x0000000000FDFDFDULL, | ||
| 1659 | 0x00000000FDFDFDFDULL, | ||
| 1660 | 0x000000FDFDFDFDFDULL, | ||
| 1661 | 0x0000FDFDFDFDFDFDULL, | ||
| 1662 | 0x00FDFDFDFDFDFDFDULL | ||
| 1663 | }, | ||
| 1664 | { | ||
| 1665 | 0x00000000000000FDULL, | ||
| 1666 | 0x000000000000FDFDULL, | ||
| 1667 | 0x0000000000FDFDFDULL, | ||
| 1668 | 0x00000000FDFDFDFDULL, | ||
| 1669 | 0x000000FDFDFDFDFDULL, | ||
| 1670 | 0x0000FDFDFDFDFDFDULL, | ||
| 1671 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1672 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1673 | }, | ||
| 1674 | { | ||
| 1675 | 0x000000000000FDFDULL, | ||
| 1676 | 0x0000000000FDFDFDULL, | ||
| 1677 | 0x00000000FDFDFDFDULL, | ||
| 1678 | 0x000000FDFDFDFDFDULL, | ||
| 1679 | 0x0000FDFDFDFDFDFDULL, | ||
| 1680 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1681 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1682 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1683 | }, | ||
| 1684 | { | ||
| 1685 | 0x0000000000FDFDFDULL, | ||
| 1686 | 0x00000000FDFDFDFDULL, | ||
| 1687 | 0x000000FDFDFDFDFDULL, | ||
| 1688 | 0x0000FDFDFDFDFDFDULL, | ||
| 1689 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1690 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1691 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1692 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1693 | }, | ||
| 1694 | { | ||
| 1695 | 0x00000000FDFDFDFDULL, | ||
| 1696 | 0x000000FDFDFDFDFDULL, | ||
| 1697 | 0x0000FDFDFDFDFDFDULL, | ||
| 1698 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1699 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1700 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1701 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1702 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1703 | }, | ||
| 1704 | { | ||
| 1705 | 0x000000FDFDFDFDFDULL, | ||
| 1706 | 0x0000FDFDFDFDFDFDULL, | ||
| 1707 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1708 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1709 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1710 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1711 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1712 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1713 | }, | ||
| 1714 | { | ||
| 1715 | 0x0000FDFDFDFDFDFDULL, | ||
| 1716 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1717 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1718 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1719 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1720 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1721 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1722 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1723 | }, | ||
| 1724 | { | ||
| 1725 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1726 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1727 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1728 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1729 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1730 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1731 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1732 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1733 | }, | ||
| 1734 | { | ||
| 1735 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1736 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1737 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1738 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1739 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1740 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1741 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1742 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1743 | } | ||
| 1744 | } | ||
| 1745 | }; | ||
| 1746 | |||
| 1747 | int32_t black_opening_count=0; | ||
| 1748 | int32_t black_opening_x,black_opening_y; | ||
| 1749 | int32_t black_opening_shape; | ||
| 1750 | |||
| 1751 | 1506 | int32_t choose_opening_shape() | |
| 1752 | { | ||
| 1753 | // First, count how many bits are set | ||
| 1754 | 1506 | int32_t numBits=0; | |
| 1755 | int32_t bitCounter; | ||
| 1756 | |||
| 1757 |
2/2✓ Branch 0 taken 7530 times.
✓ Branch 1 taken 1506 times.
|
9036 | for(int32_t i=0; i<bosMAX; i++) |
| 1758 | { | ||
| 1759 |
2/2✓ Branch 0 taken 5808 times.
✓ Branch 1 taken 1722 times.
|
7530 | if(COOLSCROLL&(1<<i)) |
| 1760 | 1722 | numBits++; | |
| 1761 | 7530 | } | |
| 1762 | |||
| 1763 | // Shouldn't happen... | ||
| 1764 |
1/2✓ Branch 0 taken 1506 times.
✗ Branch 1 not taken.
|
1506 | if(numBits==0) |
| 1765 | ✗ | return bosCIRCLE; | |
| 1766 | |||
| 1767 | // Pick a bit | ||
| 1768 | 1506 | bitCounter=zc_rand()%numBits+1; | |
| 1769 | |||
| 1770 |
2/2✓ Branch 0 taken 1991 times.
✓ Branch 1 taken 26 times.
|
2017 | for(int32_t i=0; i<bosMAX; i++) |
| 1771 | { | ||
| 1772 | // If this bit is set, decrement the bit counter | ||
| 1773 |
2/2✓ Branch 0 taken 355 times.
✓ Branch 1 taken 1636 times.
|
1991 | if(COOLSCROLL&(1<<i)) |
| 1774 | 1636 | bitCounter--; | |
| 1775 | |||
| 1776 | // When the counter hits 0, return a value based on | ||
| 1777 | // which bit it stopped on. | ||
| 1778 | // Reminder: enum {bosCIRCLE=0, bosOVAL, bosTRIANGLE, bosSMAS, bosFADEBLACK, bosMAX}; | ||
| 1779 |
2/2✓ Branch 0 taken 1480 times.
✓ Branch 1 taken 511 times.
|
1991 | if(bitCounter==0) |
| 1780 | 1480 | return i; | |
| 1781 | 511 | } | |
| 1782 | |||
| 1783 | // Shouldn't be necessary, but the compiler might complain, at least | ||
| 1784 | 26 | return bosCIRCLE; | |
| 1785 | 1506 | } | |
| 1786 | |||
| 1787 | 396 | void close_black_opening(int32_t x, int32_t y, bool wait, int32_t shape) | |
| 1788 | { | ||
| 1789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | black_opening_shape= (shape>-1 ? shape : choose_opening_shape()); |
| 1790 | |||
| 1791 | 396 | int32_t w=256, h=224; | |
| 1792 | 396 | int32_t blockrows=28, blockcolumns=32; | |
| 1793 | 396 | int32_t xoffset=(x-(w/2))/8, yoffset=(y-(h/2))/8; | |
| 1794 | |||
| 1795 |
2/2✓ Branch 0 taken 11088 times.
✓ Branch 1 taken 396 times.
|
11484 | for(int32_t blockrow=0; blockrow<blockrows; ++blockrow) //30 |
| 1796 | { | ||
| 1797 |
2/2✓ Branch 0 taken 354816 times.
✓ Branch 1 taken 11088 times.
|
365904 | for(int32_t blockcolumn=0; blockcolumn<blockcolumns; ++blockcolumn) //40 |
| 1798 | { | ||
| 1799 |
2/2✓ Branch 0 taken 188540 times.
✓ Branch 1 taken 166276 times.
|
354816 | screen_triangles[blockrow][blockcolumn]=zc_max(abs(int32_t(double(blockcolumns-1)/2-blockcolumn+xoffset)),abs(int32_t(double(blockrows-1)/2-blockrow+yoffset)))|0x0100|((blockrow-yoffset<blockrows/2)?0:0x8000)|((blockcolumn-xoffset<blockcolumns/2)?0x4000:0); |
| 1800 | 354816 | } | |
| 1801 | 11088 | } | |
| 1802 | |||
| 1803 | 396 | black_opening_count = 66; | |
| 1804 | 396 | black_opening_x = x; | |
| 1805 | 396 | black_opening_y = y; | |
| 1806 | 396 | lensclk = 0; | |
| 1807 | //black_opening_shape=(black_opening_shape+1)%bosMAX; | ||
| 1808 | |||
| 1809 | |||
| 1810 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(black_opening_shape == bosFADEBLACK) |
| 1811 | { | ||
| 1812 | ✗ | refreshTints(); | |
| 1813 | ✗ | memcpy(tempblackpal, RAMpal, sizeof(RAMpal)); //Store palette in temp palette for fade effect | |
| 1814 | ✗ | } | |
| 1815 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(wait) |
| 1816 | { | ||
| 1817 | ✗ | FFCore.warpScriptCheck(); | |
| 1818 | ✗ | for(int32_t i=0; i<66; i++) | |
| 1819 | { | ||
| 1820 | ✗ | draw_screen(tmpscr); | |
| 1821 | //put_passive_subscr(framebuf,0,passive_subscreen_offset,false,sspUP); | ||
| 1822 | ✗ | advanceframe(true); | |
| 1823 | |||
| 1824 | ✗ | if(Quit) | |
| 1825 | { | ||
| 1826 | ✗ | break; | |
| 1827 | } | ||
| 1828 | ✗ | } | |
| 1829 | ✗ | } | |
| 1830 | 396 | } | |
| 1831 | |||
| 1832 | 1110 | void open_black_opening(int32_t x, int32_t y, bool wait, int32_t shape) | |
| 1833 | { | ||
| 1834 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1110 times.
|
1110 | black_opening_shape= (shape>-1 ? shape : choose_opening_shape()); |
| 1835 | |||
| 1836 | 1110 | int32_t w=256, h=224; | |
| 1837 | 1110 | int32_t blockrows=28, blockcolumns=32; | |
| 1838 | 1110 | int32_t xoffset=(x-(w/2))/8, yoffset=(y-(h/2))/8; | |
| 1839 | |||
| 1840 |
2/2✓ Branch 0 taken 31080 times.
✓ Branch 1 taken 1110 times.
|
32190 | for(int32_t blockrow=0; blockrow<blockrows; ++blockrow) //30 |
| 1841 | { | ||
| 1842 |
2/2✓ Branch 0 taken 994560 times.
✓ Branch 1 taken 31080 times.
|
1025640 | for(int32_t blockcolumn=0; blockcolumn<blockcolumns; ++blockcolumn) //40 |
| 1843 | { | ||
| 1844 |
2/2✓ Branch 0 taken 442260 times.
✓ Branch 1 taken 552300 times.
|
994560 | screen_triangles[blockrow][blockcolumn]=zc_max(abs(int32_t(double(blockcolumns-1)/2-blockcolumn+xoffset)),abs(int32_t(double(blockrows-1)/2-blockrow+yoffset)))|0x0100|((blockrow-yoffset<blockrows/2)?0:0x8000)|((blockcolumn-xoffset<blockcolumns/2)?0x4000:0); |
| 1845 | 994560 | } | |
| 1846 | 31080 | } | |
| 1847 | |||
| 1848 | 1110 | black_opening_count = -66; | |
| 1849 | 1110 | black_opening_x = x; | |
| 1850 | 1110 | black_opening_y = y; | |
| 1851 | 1110 | lensclk = 0; | |
| 1852 |
1/2✓ Branch 0 taken 1110 times.
✗ Branch 1 not taken.
|
1110 | if(black_opening_shape == bosFADEBLACK) |
| 1853 | { | ||
| 1854 | ✗ | refreshTints(); | |
| 1855 | ✗ | memcpy(tempblackpal, RAMpal, sizeof(RAMpal)); //Store palette in temp palette for fade effect | |
| 1856 | ✗ | } | |
| 1857 |
2/2✓ Branch 0 taken 199 times.
✓ Branch 1 taken 911 times.
|
1110 | if(wait) |
| 1858 | { | ||
| 1859 | 911 | FFCore.warpScriptCheck(); | |
| 1860 |
2/2✓ Branch 0 taken 911 times.
✓ Branch 1 taken 60126 times.
|
61037 | for(int32_t i=0; i<66; i++) |
| 1861 | { | ||
| 1862 | 60126 | draw_screen(tmpscr); | |
| 1863 | //put_passive_subscr(framebuf,0,passive_subscreen_offset,false,sspUP); | ||
| 1864 | 60126 | advanceframe(true); | |
| 1865 | |||
| 1866 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60126 times.
|
60126 | if(Quit) |
| 1867 | { | ||
| 1868 | ✗ | break; | |
| 1869 | } | ||
| 1870 | 60126 | } | |
| 1871 | 911 | } | |
| 1872 | 1110 | } | |
| 1873 | |||
| 1874 | 99396 | void black_opening(BITMAP *dest,int32_t x,int32_t y,int32_t a,int32_t max_a) | |
| 1875 | { | ||
| 1876 | 99396 | clear_to_color(tmp_scr,BLACK); | |
| 1877 | 99396 | int32_t w=256, h=224; | |
| 1878 | |||
| 1879 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 858 times.
✓ Branch 2 taken 660 times.
✓ Branch 3 taken 7656 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 90222 times.
|
99396 | switch(black_opening_shape) |
| 1880 | { | ||
| 1881 | case bosOVAL: | ||
| 1882 | { | ||
| 1883 | 858 | double new_w=(w/2)+abs(w/2-x); | |
| 1884 | 858 | double new_h=(h/2)+abs(h/2-y); | |
| 1885 | 858 | double b=sqrt(((new_w*new_w)/4)+(new_h*new_h)); | |
| 1886 | 858 | ellipsefill(tmp_scr,x,y,int32_t(2*a*b/max_a)/8*8,int32_t(a*b/max_a)/8*8,0); | |
| 1887 | 858 | break; | |
| 1888 | } | ||
| 1889 | |||
| 1890 | case bosTRIANGLE: | ||
| 1891 | { | ||
| 1892 | 660 | double new_w=(w/2)+abs(w/2-x); | |
| 1893 | 660 | double new_h=(h/2)+abs(h/2-y); | |
| 1894 | 660 | double r=a*(new_w*sqrt((double)3)+new_h)/max_a; | |
| 1895 | 660 | double P2= (PI/2); | |
| 1896 | 660 | double P23=(2*PI/3); | |
| 1897 | 660 | double P43=(4*PI/3); | |
| 1898 | 660 | double Pa= (-4*PI*a/(3*max_a)); | |
| 1899 | 660 | double angle=P2+Pa; | |
| 1900 | 660 | double a0=angle; | |
| 1901 | 660 | double a2=angle+P23; | |
| 1902 | 660 | double a4=angle+P43; | |
| 1903 | 1320 | triangle(tmp_scr, x+int32_t(zc::math::Cos(a0)*r), y-int32_t(zc::math::Sin(a0)*r), | |
| 1904 | 660 | x+int32_t(zc::math::Cos(a2)*r), y-int32_t(zc::math::Sin(a2)*r), | |
| 1905 | 660 | x+int32_t(zc::math::Cos(a4)*r), y-int32_t(zc::math::Sin(a4)*r), | |
| 1906 | 0); | ||
| 1907 | 660 | break; | |
| 1908 | } | ||
| 1909 | |||
| 1910 | case bosSMAS: | ||
| 1911 | { | ||
| 1912 |
2/2✓ Branch 0 taken 2838 times.
✓ Branch 1 taken 4818 times.
|
7656 | int32_t distance=zc_max(abs(w/2-x),abs(h/2-y))/8; |
| 1913 | |||
| 1914 |
2/2✓ Branch 0 taken 214368 times.
✓ Branch 1 taken 7656 times.
|
222024 | for(int32_t blockrow=0; blockrow<28; ++blockrow) //30 |
| 1915 | { | ||
| 1916 |
2/2✓ Branch 0 taken 1714944 times.
✓ Branch 1 taken 214368 times.
|
1929312 | for(int32_t linerow=0; linerow<8; ++linerow) |
| 1917 | { | ||
| 1918 | 1714944 | qword *triangleline=(qword*)(tmp_scr->line[(blockrow*8+linerow)]); | |
| 1919 | |||
| 1920 |
2/2✓ Branch 0 taken 54878208 times.
✓ Branch 1 taken 1714944 times.
|
56593152 | for(int32_t blockcolumn=0; blockcolumn<32; ++blockcolumn) //40 |
| 1921 | { | ||
| 1922 | 164634624 | *triangleline=triangles[(screen_triangles[blockrow][blockcolumn]&0xC000)>>14] | |
| 1923 |
6/6✓ Branch 0 taken 38180568 times.
✓ Branch 1 taken 16697640 times.
✓ Branch 2 taken 35934032 times.
✓ Branch 3 taken 18944176 times.
✓ Branch 4 taken 19236392 times.
✓ Branch 5 taken 16697640 times.
|
54878208 | [zc_min(zc_max((((31+distance)*(max_a-a)/max_a)+((screen_triangles[blockrow][blockcolumn]&0x0FFF)-0x0100)-(15+distance)),0),15)] |
| 1924 | 54878208 | [linerow]; | |
| 1925 | 54878208 | ++triangleline; | |
| 1926 | |||
| 1927 |
2/2✓ Branch 0 taken 48018432 times.
✓ Branch 1 taken 6859776 times.
|
54878208 | if(linerow==0) |
| 1928 | { | ||
| 1929 | 6859776 | } | |
| 1930 | 54878208 | } | |
| 1931 | 1714944 | } | |
| 1932 | 214368 | } | |
| 1933 | |||
| 1934 | 7656 | break; | |
| 1935 | } | ||
| 1936 | |||
| 1937 | case bosFADEBLACK: | ||
| 1938 | { | ||
| 1939 | ✗ | if(black_opening_count<0) | |
| 1940 | { | ||
| 1941 | ✗ | black_fade(zc_min(-black_opening_count,63)); | |
| 1942 | ✗ | } | |
| 1943 | ✗ | else if(black_opening_count>0) | |
| 1944 | { | ||
| 1945 | ✗ | black_fade(63-zc_max(black_opening_count-3,0)); | |
| 1946 | ✗ | } | |
| 1947 | ✗ | else black_fade(0); | |
| 1948 | ✗ | return; //no blitting from tmp_scr! | |
| 1949 | } | ||
| 1950 | |||
| 1951 | 90222 | case bosCIRCLE: | |
| 1952 | default: | ||
| 1953 | { | ||
| 1954 | 90222 | double new_w=(w/2)+abs(w/2-x); | |
| 1955 | 90222 | double new_h=(h/2)+abs(h/2-y); | |
| 1956 | 90222 | int32_t r=int32_t(sqrt((new_w*new_w)+(new_h*new_h))*a/max_a); | |
| 1957 | //circlefill(tmp_scr,x,y,a<<3,0); | ||
| 1958 | 90222 | circlefill(tmp_scr,x,y,r,0); | |
| 1959 | 90222 | break; | |
| 1960 | } | ||
| 1961 | } | ||
| 1962 | |||
| 1963 | 99396 | masked_blit(tmp_scr,dest,0,0,0,0,320,240); | |
| 1964 | 99396 | } | |
| 1965 | |||
| 1966 | |||
| 1967 | ✗ | void black_fade(int32_t fadeamnt) | |
| 1968 | { | ||
| 1969 | ✗ | for(int32_t i=0; i < 0xEF; i++) | |
| 1970 | { | ||
| 1971 | ✗ | RAMpal[i].r = vbound(tempblackpal[i].r-fadeamnt,0,63); | |
| 1972 | ✗ | RAMpal[i].g = vbound(tempblackpal[i].g-fadeamnt,0,63); | |
| 1973 | ✗ | RAMpal[i].b = vbound(tempblackpal[i].b-fadeamnt,0,63); | |
| 1974 | ✗ | } | |
| 1975 | |||
| 1976 | ✗ | refreshpal = true; | |
| 1977 | ✗ | } | |
| 1978 | |||
| 1979 | //---------------------------------------------------------------- | ||
| 1980 | |||
| 1981 | 38804483 | bool item_disabled(int32_t item) //is this item disabled? | |
| 1982 | { | ||
| 1983 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38804483 times.
|
38804483 | return (unsigned(item) < MAXITEMS && game->items_off[item] != 0); |
| 1984 | } | ||
| 1985 | |||
| 1986 | 7615632 | bool can_use_item(int32_t item_type, int32_t item) //can Hero use this item? | |
| 1987 | { | ||
| 1988 |
2/2✓ Branch 0 taken 135248 times.
✓ Branch 1 taken 7480384 times.
|
7615632 | if(current_item(item_type, true) >=item) |
| 1989 | { | ||
| 1990 | 135248 | return true; | |
| 1991 | } | ||
| 1992 | |||
| 1993 | 7480384 | return false; | |
| 1994 | 7615632 | } | |
| 1995 | |||
| 1996 | 30661706 | bool has_item(int32_t item_type, int32_t it) //does Hero possess this item? | |
| 1997 | { | ||
| 1998 |
5/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 6051811 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3220277 times.
✓ Branch 6 taken 16010210 times.
✓ Branch 7 taken 5337672 times.
✓ Branch 8 taken 41736 times.
|
30661706 | switch(item_type) |
| 1999 | { | ||
| 2000 | case itype_bomb: | ||
| 2001 | case itype_sbomb: | ||
| 2002 | { | ||
| 2003 | ✗ | int32_t itemid = getItemID(itemsbuf, item_type, it); | |
| 2004 | |||
| 2005 | ✗ | if(itemid == -1) | |
| 2006 | ✗ | return false; | |
| 2007 | |||
| 2008 | ✗ | return (game->get_item(itemid)); | |
| 2009 | } | ||
| 2010 | |||
| 2011 | case itype_clock: | ||
| 2012 | { | ||
| 2013 | 6051811 | int32_t itemid = getItemID(itemsbuf, item_type, it); | |
| 2014 | |||
| 2015 |
2/4✓ Branch 0 taken 6051811 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6051811 times.
✗ Branch 3 not taken.
|
6051811 | if(itemid != -1 && (itemsbuf[itemid].flags & ITEM_FLAG1)) //Active clock |
| 2016 | ✗ | return (game->get_item(itemid)); | |
| 2017 | 6051811 | return Hero.getClock()?1:0; | |
| 2018 | } | ||
| 2019 | |||
| 2020 | case itype_key: | ||
| 2021 | ✗ | return (game->get_keys()>0); | |
| 2022 | |||
| 2023 | case itype_magiccontainer: | ||
| 2024 | ✗ | return (game->get_maxmagic()>=game->get_mp_per_block()); | |
| 2025 | |||
| 2026 | case itype_triforcepiece: //it: -2=any, -1=current level, other=that level | ||
| 2027 | { | ||
| 2028 |
1/3✓ Branch 0 taken 3220277 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
3220277 | switch(it) |
| 2029 | { | ||
| 2030 | case -2: | ||
| 2031 | { | ||
| 2032 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 2033 | { | ||
| 2034 | ✗ | if(game->lvlitems[i]&liTRIFORCE) | |
| 2035 | { | ||
| 2036 | ✗ | return true; | |
| 2037 | } | ||
| 2038 | ✗ | } | |
| 2039 | |||
| 2040 | ✗ | return false; | |
| 2041 | } | ||
| 2042 | |||
| 2043 | case -1: | ||
| 2044 | ✗ | return (game->lvlitems[dlevel]&liTRIFORCE); | |
| 2045 | |||
| 2046 | default: | ||
| 2047 |
2/4✓ Branch 0 taken 3220277 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3220277 times.
|
3220277 | if(it>=0&&it<MAXLEVELS) |
| 2048 | { | ||
| 2049 | 3220277 | return (game->lvlitems[it]&liTRIFORCE); | |
| 2050 | } | ||
| 2051 | |||
| 2052 | ✗ | break; | |
| 2053 | } | ||
| 2054 | |||
| 2055 | ✗ | return 0; | |
| 2056 | } | ||
| 2057 | |||
| 2058 | case itype_map: //it: -2=any, -1=current level, other=that level | ||
| 2059 | { | ||
| 2060 |
1/3✓ Branch 0 taken 16010210 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
16010210 | switch(it) |
| 2061 | { | ||
| 2062 | case -2: | ||
| 2063 | { | ||
| 2064 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 2065 | { | ||
| 2066 | ✗ | if(game->lvlitems[i]&liMAP) | |
| 2067 | { | ||
| 2068 | ✗ | return true; | |
| 2069 | } | ||
| 2070 | ✗ | } | |
| 2071 | |||
| 2072 | ✗ | return false; | |
| 2073 | } | ||
| 2074 | |||
| 2075 | case -1: | ||
| 2076 | ✗ | return (game->lvlitems[dlevel]&liMAP)!=0; | |
| 2077 | |||
| 2078 | default: | ||
| 2079 |
2/4✓ Branch 0 taken 16010210 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 16010210 times.
|
16010210 | if(it>=0&&it<MAXLEVELS) |
| 2080 | { | ||
| 2081 | 16010210 | return (game->lvlitems[it]&liMAP)!=0; | |
| 2082 | } | ||
| 2083 | |||
| 2084 | ✗ | break; | |
| 2085 | } | ||
| 2086 | |||
| 2087 | ✗ | return 0; | |
| 2088 | } | ||
| 2089 | |||
| 2090 | case itype_compass: //it: -2=any, -1=current level, other=that level | ||
| 2091 | { | ||
| 2092 |
1/3✓ Branch 0 taken 5337672 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
5337672 | switch(it) |
| 2093 | { | ||
| 2094 | case -2: | ||
| 2095 | { | ||
| 2096 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 2097 | { | ||
| 2098 | ✗ | if(game->lvlitems[i]&liCOMPASS) | |
| 2099 | { | ||
| 2100 | ✗ | return true; | |
| 2101 | } | ||
| 2102 | ✗ | } | |
| 2103 | |||
| 2104 | ✗ | return false; | |
| 2105 | } | ||
| 2106 | |||
| 2107 | case -1: | ||
| 2108 | ✗ | return (game->lvlitems[dlevel]&liCOMPASS)!=0; | |
| 2109 | |||
| 2110 | default: | ||
| 2111 |
2/4✓ Branch 0 taken 5337672 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5337672 times.
✗ Branch 3 not taken.
|
5337672 | if(it>=0&&it<MAXLEVELS) |
| 2112 | { | ||
| 2113 | 5337672 | return (game->lvlitems[it]&liCOMPASS)!=0; | |
| 2114 | } | ||
| 2115 | |||
| 2116 | ✗ | break; | |
| 2117 | } | ||
| 2118 | ✗ | return 0; | |
| 2119 | } | ||
| 2120 | |||
| 2121 | case itype_bosskey: //it: -2=any, -1=current level, other=that level | ||
| 2122 | { | ||
| 2123 |
1/3✓ Branch 0 taken 41736 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
41736 | switch(it) |
| 2124 | { | ||
| 2125 | case -2: | ||
| 2126 | { | ||
| 2127 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 2128 | { | ||
| 2129 | ✗ | if(game->lvlitems[i]&liBOSSKEY) | |
| 2130 | { | ||
| 2131 | ✗ | return true; | |
| 2132 | } | ||
| 2133 | ✗ | } | |
| 2134 | |||
| 2135 | ✗ | return false; | |
| 2136 | } | ||
| 2137 | |||
| 2138 | case -1: | ||
| 2139 | ✗ | return (game->lvlitems[dlevel]&liBOSSKEY)?1:0; | |
| 2140 | |||
| 2141 | default: | ||
| 2142 |
2/4✓ Branch 0 taken 41736 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 41736 times.
|
41736 | if(it>=0&&it<MAXLEVELS) |
| 2143 | { | ||
| 2144 | 41736 | return (game->lvlitems[it]&liBOSSKEY)?1:0; | |
| 2145 | } | ||
| 2146 | ✗ | break; | |
| 2147 | } | ||
| 2148 | ✗ | return 0; | |
| 2149 | } | ||
| 2150 | |||
| 2151 | default: | ||
| 2152 | //it=(1<<(it-1)); | ||
| 2153 | /*if (item_type>=itype_max) | ||
| 2154 | { | ||
| 2155 | enter_sys_pal(); | ||
| 2156 | jwin_alert("Error","has_item exception",NULL,NULL,"O&K",NULL,'k',0,get_zc_font(font_lfont)); | ||
| 2157 | exit_sys_pal(); | ||
| 2158 | |||
| 2159 | return false; | ||
| 2160 | }*/ | ||
| 2161 | ✗ | int32_t itemid = getItemID(itemsbuf, item_type, it); | |
| 2162 | |||
| 2163 | ✗ | if(itemid == -1) | |
| 2164 | ✗ | return false; | |
| 2165 | |||
| 2166 | ✗ | return game->get_item(itemid); | |
| 2167 | } | ||
| 2168 | 30661706 | } | |
| 2169 | |||
| 2170 | |||
| 2171 | 99990132 | int32_t current_item(int32_t item_type, bool checkenabled) //item currently being used | |
| 2172 | { | ||
| 2173 |
9/9✓ Branch 0 taken 6051811 times.
✓ Branch 1 taken 51575644 times.
✓ Branch 2 taken 6051811 times.
✓ Branch 3 taken 6051811 times.
✓ Branch 4 taken 6051811 times.
✓ Branch 5 taken 6051811 times.
✓ Branch 6 taken 6051811 times.
✓ Branch 7 taken 6051811 times.
✓ Branch 8 taken 6051811 times.
|
99990132 | switch(item_type) |
| 2174 | { | ||
| 2175 | case itype_clock: | ||
| 2176 | { | ||
| 2177 | 6051811 | int32_t maxid = getHighestLevelOfFamily(game, itemsbuf, item_type, checkenabled); | |
| 2178 | |||
| 2179 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6051811 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6051811 | if(maxid != -1 && (itemsbuf[maxid].flags & ITEM_FLAG1)) //Active clock |
| 2180 | ✗ | return itemsbuf[maxid].fam_type; | |
| 2181 | |||
| 2182 | 6051811 | return has_item(itype_clock,1) ? 1 : 0; | |
| 2183 | } | ||
| 2184 | |||
| 2185 | case itype_key: | ||
| 2186 | 6051811 | return game->get_keys(); | |
| 2187 | |||
| 2188 | case itype_lkey: | ||
| 2189 | 6051811 | return game->lvlkeys[get_dlevel()]; | |
| 2190 | |||
| 2191 | case itype_magiccontainer: | ||
| 2192 | 6051811 | return game->get_maxmagic()/game->get_mp_per_block(); | |
| 2193 | |||
| 2194 | case itype_triforcepiece: | ||
| 2195 | { | ||
| 2196 | 6051811 | int32_t count=0; | |
| 2197 | |||
| 2198 |
2/2✓ Branch 0 taken 3098527232 times.
✓ Branch 1 taken 6051811 times.
|
3104579043 | for(int32_t i=0; i<MAXLEVELS; i++) |
| 2199 | { | ||
| 2200 | 3098527232 | count+=(game->lvlitems[i]&liTRIFORCE)?1:0; | |
| 2201 | 3098527232 | } | |
| 2202 | |||
| 2203 | 6051811 | return count; | |
| 2204 | } | ||
| 2205 | |||
| 2206 | case itype_map: | ||
| 2207 | { | ||
| 2208 | 6051811 | int32_t count=0; | |
| 2209 | |||
| 2210 |
2/2✓ Branch 0 taken 3098527232 times.
✓ Branch 1 taken 6051811 times.
|
3104579043 | for(int32_t i=0; i<MAXLEVELS; i++) |
| 2211 | { | ||
| 2212 | 3098527232 | count+=(game->lvlitems[i]&liMAP)?1:0; | |
| 2213 | 3098527232 | } | |
| 2214 | |||
| 2215 | 6051811 | return count; | |
| 2216 | } | ||
| 2217 | |||
| 2218 | case itype_compass: | ||
| 2219 | { | ||
| 2220 | 6051811 | int32_t count=0; | |
| 2221 | |||
| 2222 |
2/2✓ Branch 0 taken 3098527232 times.
✓ Branch 1 taken 6051811 times.
|
3104579043 | for(int32_t i=0; i<MAXLEVELS; i++) |
| 2223 | { | ||
| 2224 | 3098527232 | count+=(game->lvlitems[i]&liCOMPASS)?1:0; | |
| 2225 | 3098527232 | } | |
| 2226 | |||
| 2227 | 6051811 | return count; | |
| 2228 | } | ||
| 2229 | |||
| 2230 | case itype_bosskey: | ||
| 2231 | { | ||
| 2232 | 6051811 | int32_t count=0; | |
| 2233 | |||
| 2234 |
2/2✓ Branch 0 taken 3098527232 times.
✓ Branch 1 taken 6051811 times.
|
3104579043 | for(int32_t i=0; i<MAXLEVELS; i++) |
| 2235 | { | ||
| 2236 | 3098527232 | count+=(game->lvlitems[i]&liBOSSKEY)?1:0; | |
| 2237 | 3098527232 | } | |
| 2238 | |||
| 2239 | 6051811 | return count; | |
| 2240 | } | ||
| 2241 | |||
| 2242 | default: | ||
| 2243 | 51575644 | int32_t maxid = getHighestLevelOfFamily(game, itemsbuf, item_type, checkenabled); | |
| 2244 | |||
| 2245 |
2/2✓ Branch 0 taken 9877306 times.
✓ Branch 1 taken 41698338 times.
|
51575644 | if(maxid == -1) |
| 2246 | 41698338 | return 0; | |
| 2247 | |||
| 2248 | 9877306 | return itemsbuf[maxid].fam_type; | |
| 2249 | } | ||
| 2250 | 99990132 | } | |
| 2251 | |||
| 2252 | 92374500 | int32_t current_item(int32_t item_type) //item currently being used | |
| 2253 | { | ||
| 2254 | 92374500 | return current_item(item_type, true); | |
| 2255 | } | ||
| 2256 | |||
| 2257 | 46 | std::map<int32_t, int32_t> itemcache; | |
| 2258 | |||
| 2259 | // Not actually used by anything at the moment... | ||
| 2260 | ✗ | void removeFromItemCache(int32_t itemclass) | |
| 2261 | { | ||
| 2262 | ✗ | itemcache.erase(itemclass); | |
| 2263 | ✗ | } | |
| 2264 | |||
| 2265 | 30015 | void flushItemCache() | |
| 2266 | { | ||
| 2267 | 30015 | itemcache.clear(); | |
| 2268 | |||
| 2269 | //also fix the active subscreen if items were deleted -DD | ||
| 2270 |
1/2✓ Branch 0 taken 30015 times.
✗ Branch 1 not taken.
|
30015 | if(game != NULL) |
| 2271 | { | ||
| 2272 | 30015 | verifyBothWeapons(); | |
| 2273 | 30015 | load_Sitems(); | |
| 2274 | 30015 | } | |
| 2275 | 30015 | } | |
| 2276 | |||
| 2277 | // This is used often, so it should be as direct as possible. | ||
| 2278 | 3369515981 | int32_t _c_item_id_internal(int32_t itemtype, bool checkmagic, bool jinx_check) | |
| 2279 | { | ||
| 2280 |
2/2✓ Branch 0 taken 3294027853 times.
✓ Branch 1 taken 75488128 times.
|
3369515981 | if(jinx_check) |
| 2281 | { | ||
| 2282 |
4/4✓ Branch 0 taken 47336794 times.
✓ Branch 1 taken 28151334 times.
✓ Branch 2 taken 39070031 times.
✓ Branch 3 taken 8266763 times.
|
75488128 | if(!(HeroSwordClk() || HeroItemClk())) |
| 2283 | 39070031 | jinx_check = false; //not jinxed | |
| 2284 | 75488128 | } | |
| 2285 |
4/4✓ Branch 0 taken 3340134867 times.
✓ Branch 1 taken 29381114 times.
✓ Branch 2 taken 36085402 times.
✓ Branch 3 taken 3304049465 times.
|
3369515981 | if(itemtype!=itype_ring && !jinx_check) // Rings must always be checked, as must jinx checks... |
| 2286 | { | ||
| 2287 | 3304049465 | std::map<int32_t,int32_t>::iterator res = itemcache.find(itemtype); | |
| 2288 | |||
| 2289 |
2/2✓ Branch 0 taken 3288724855 times.
✓ Branch 1 taken 15324610 times.
|
3304049465 | if(res != itemcache.end()) |
| 2290 | 3288724855 | return res->second; | |
| 2291 | 15324610 | } | |
| 2292 | |||
| 2293 | 80791126 | int32_t result = -1; | |
| 2294 | 80791126 | int32_t highestlevel = -1; | |
| 2295 | |||
| 2296 |
2/2✓ Branch 0 taken 20682528256 times.
✓ Branch 1 taken 80791126 times.
|
20763319382 | for(int32_t i=0; i<MAXITEMS; i++) |
| 2297 | { | ||
| 2298 |
5/6✓ Branch 0 taken 1516689613 times.
✓ Branch 1 taken 19165838643 times.
✓ Branch 2 taken 21712380 times.
✓ Branch 3 taken 1494977233 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 21712380 times.
|
20682528256 | if(game->get_item(i) && itemsbuf[i].family==itemtype && !item_disabled(i)) |
| 2299 | { | ||
| 2300 |
4/4✓ Branch 0 taken 5877366 times.
✓ Branch 1 taken 15835014 times.
✓ Branch 2 taken 1816939 times.
✓ Branch 3 taken 19895441 times.
|
21712380 | if((checkmagic || itemtype == itype_ring) && itemtype != itype_magicring) |
| 2301 | { | ||
| 2302 | //printf("Checkmagic for %d: %d (%d %d)\n",i,checkmagiccost(i),itemsbuf[i].magic*game->get_magicdrainrate(),game->get_magic()); | ||
| 2303 |
2/2✓ Branch 0 taken 19895268 times.
✓ Branch 1 taken 173 times.
|
19895441 | if(!checkmagiccost(i)) |
| 2304 | { | ||
| 2305 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 161 times.
|
173 | if ( !get_qr(qr_NEVERDISABLEAMMOONSUBSCREEN) ) continue; //don't make items with a magic cost vanish!! -Z |
| 2306 | 12 | } | |
| 2307 | 19895280 | } | |
| 2308 |
6/6✓ Branch 0 taken 18412977 times.
✓ Branch 1 taken 3299242 times.
✓ Branch 2 taken 311736 times.
✓ Branch 3 taken 2987506 times.
✓ Branch 4 taken 1796725 times.
✓ Branch 5 taken 1502517 times.
|
21712219 | if(jinx_check && (usesSwordJinx(i) ? HeroSwordClk() : HeroItemClk())) |
| 2309 | { | ||
| 2310 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1502517 times.
|
1502517 | if(!(itemsbuf[i].flags & ITEM_JINX_IMMUNE)) |
| 2311 | 1502517 | continue; | |
| 2312 | ✗ | } | |
| 2313 | |||
| 2314 |
2/2✓ Branch 0 taken 278912 times.
✓ Branch 1 taken 19930790 times.
|
20209702 | if(itemsbuf[i].fam_type >= highestlevel) |
| 2315 | { | ||
| 2316 | 19930790 | highestlevel = itemsbuf[i].fam_type; | |
| 2317 | 19930790 | result=i; | |
| 2318 | 19930790 | } | |
| 2319 | 20209702 | } | |
| 2320 | 20681025578 | } | |
| 2321 | |||
| 2322 |
2/2✓ Branch 0 taken 36418097 times.
✓ Branch 1 taken 44373029 times.
|
80791126 | if(!jinx_check) //Can't cache jinx_check results |
| 2323 | 44373029 | itemcache[itemtype] = result; | |
| 2324 | 80791126 | return result; | |
| 2325 | 3369515981 | } | |
| 2326 | |||
| 2327 | // 'jinx_check' indicates that the highest level item *immune to jinxes* should be returned. | ||
| 2328 | 3333542097 | int32_t current_item_id(int32_t itemtype, bool checkmagic, bool jinx_check) | |
| 2329 | { | ||
| 2330 | 3333542097 | auto ret = _c_item_id_internal(itemtype,checkmagic,jinx_check); | |
| 2331 |
2/2✓ Branch 0 taken 39514244 times.
✓ Branch 1 taken 3294027853 times.
|
3333542097 | if(!jinx_check) //If not already a jinx-immune-only check... |
| 2332 | { | ||
| 2333 | //And the player IS jinxed... | ||
| 2334 |
4/4✓ Branch 0 taken 3266219496 times.
✓ Branch 1 taken 27808357 times.
✓ Branch 2 taken 8165527 times.
✓ Branch 3 taken 3258053969 times.
|
3294027853 | if(HeroSwordClk() || HeroItemClk()) |
| 2335 | { | ||
| 2336 | //Then do a jinx-immune-only check here | ||
| 2337 | 35973884 | auto ret2 = _c_item_id_internal(itemtype,checkmagic,true); | |
| 2338 | //And *IF IT FINDS A VALID ITEM*, return that one instead! -Em | ||
| 2339 | //Should NOT need a compat rule, as this should always return -1 in old quests. | ||
| 2340 |
2/2✓ Branch 0 taken 1214282 times.
✓ Branch 1 taken 34759602 times.
|
35973884 | if(ret2 > -1) return ret2; |
| 2341 | 34759602 | } | |
| 2342 | 3292813571 | } | |
| 2343 | 3332327815 | return ret; | |
| 2344 | 3333542097 | } | |
| 2345 | 19237880 | int32_t current_item_power(int32_t itemtype) | |
| 2346 | { | ||
| 2347 | 19237880 | int32_t result = current_item_id(itemtype,true); | |
| 2348 |
2/2✓ Branch 0 taken 13950304 times.
✓ Branch 1 taken 5287576 times.
|
19237880 | return (result<0) ? 0 : itemsbuf[result].power; |
| 2349 | } | ||
| 2350 | |||
| 2351 | 11 | int32_t heart_container_id() | |
| 2352 | { | ||
| 2353 |
1/2✓ Branch 0 taken 319 times.
✗ Branch 1 not taken.
|
319 | for(int32_t i=0; i<MAXITEMS; i++) |
| 2354 | { | ||
| 2355 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 308 times.
|
319 | if(itemsbuf[i].family == itype_heartcontainer) |
| 2356 | { | ||
| 2357 | 11 | return i; | |
| 2358 | } | ||
| 2359 | 308 | } | |
| 2360 | ✗ | return -1; | |
| 2361 | 11 | } | |
| 2362 | |||
| 2363 | 6051811 | int32_t item_tile_mod() | |
| 2364 | { | ||
| 2365 | 6051811 | int32_t tile=0; | |
| 2366 | |||
| 2367 |
2/2✓ Branch 0 taken 1204800 times.
✓ Branch 1 taken 4847011 times.
|
6051811 | if(game->get_bombs()) |
| 2368 | { | ||
| 2369 | 4847011 | int32_t itemid = current_item_id(itype_bomb,false); | |
| 2370 |
3/4✓ Branch 0 taken 4681842 times.
✓ Branch 1 taken 165169 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4681842 times.
|
4847011 | if(itemid > -1 && checkbunny(itemid)) |
| 2371 | 4681842 | tile+=itemsbuf[itemid].ltm; | |
| 2372 | 4847011 | } | |
| 2373 | |||
| 2374 |
2/2✓ Branch 0 taken 4537735 times.
✓ Branch 1 taken 1514076 times.
|
6051811 | if(game->get_sbombs()) |
| 2375 | { | ||
| 2376 | 1514076 | int32_t itemid = current_item_id(itype_sbomb,false); | |
| 2377 |
3/4✓ Branch 0 taken 1512648 times.
✓ Branch 1 taken 1428 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1512648 times.
|
1514076 | if(itemid > -1 && checkbunny(itemid)) |
| 2378 | 1512648 | tile+=itemsbuf[itemid].ltm; | |
| 2379 | 1514076 | } | |
| 2380 | |||
| 2381 |
2/2✓ Branch 0 taken 5942111 times.
✓ Branch 1 taken 109700 times.
|
6051811 | if(current_item(itype_clock)) |
| 2382 | { | ||
| 2383 | 109700 | int32_t itemid = | |
| 2384 |
1/2✓ Branch 0 taken 109700 times.
✗ Branch 1 not taken.
|
109700 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2385 | ? iClock | ||
| 2386 | ✗ | : getHighestLevelEvenUnowned(itemsbuf, itype_clock); | |
| 2387 |
2/4✓ Branch 0 taken 109700 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 109700 times.
|
109700 | if(itemid > -1 && checkbunny(itemid)) |
| 2388 | 109700 | tile+=itemsbuf[itemid].ltm; | |
| 2389 | 109700 | } | |
| 2390 | |||
| 2391 |
2/2✓ Branch 0 taken 4671070 times.
✓ Branch 1 taken 1380741 times.
|
6051811 | if(current_item(itype_key)) |
| 2392 | { | ||
| 2393 | 1380741 | int32_t itemid = | |
| 2394 |
1/2✓ Branch 0 taken 1380741 times.
✗ Branch 1 not taken.
|
1380741 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2395 | ? iKey | ||
| 2396 | ✗ | : getHighestLevelEvenUnowned(itemsbuf, itype_key); | |
| 2397 |
2/4✓ Branch 0 taken 1380741 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1380741 times.
|
1380741 | if(itemid > -1 && checkbunny(itemid)) |
| 2398 | 1380741 | tile+=itemsbuf[itemid].ltm; | |
| 2399 | 1380741 | } | |
| 2400 | |||
| 2401 |
2/2✓ Branch 0 taken 5784708 times.
✓ Branch 1 taken 267103 times.
|
6051811 | if(current_item(itype_lkey)) |
| 2402 | { | ||
| 2403 | 267103 | int32_t itemid = | |
| 2404 |
2/2✓ Branch 0 taken 266193 times.
✓ Branch 1 taken 910 times.
|
267103 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2405 | ? iLevelKey | ||
| 2406 | 910 | : getHighestLevelEvenUnowned(itemsbuf, itype_lkey); | |
| 2407 |
2/4✓ Branch 0 taken 267103 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 267103 times.
|
267103 | if(itemid > -1 && checkbunny(itemid)) |
| 2408 | 267103 | tile+=itemsbuf[itemid].ltm; | |
| 2409 | 267103 | } | |
| 2410 | |||
| 2411 |
2/2✓ Branch 0 taken 1254994 times.
✓ Branch 1 taken 4796817 times.
|
6051811 | if(current_item(itype_map)) |
| 2412 | { | ||
| 2413 | 4796817 | int32_t itemid = | |
| 2414 |
2/2✓ Branch 0 taken 4796031 times.
✓ Branch 1 taken 786 times.
|
4796817 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2415 | ? iMap | ||
| 2416 | 786 | : getHighestLevelEvenUnowned(itemsbuf, itype_map); | |
| 2417 |
2/4✓ Branch 0 taken 4796817 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4796817 times.
|
4796817 | if(itemid > -1 && checkbunny(itemid)) |
| 2418 | 4796817 | tile+=itemsbuf[itemid].ltm; | |
| 2419 | 4796817 | } | |
| 2420 | |||
| 2421 |
2/2✓ Branch 0 taken 1233112 times.
✓ Branch 1 taken 4818699 times.
|
6051811 | if(current_item(itype_compass)) |
| 2422 | { | ||
| 2423 | 4818699 | int32_t itemid = | |
| 2424 |
2/2✓ Branch 0 taken 4737640 times.
✓ Branch 1 taken 81059 times.
|
4818699 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2425 | ? iCompass | ||
| 2426 | 81059 | : getHighestLevelEvenUnowned(itemsbuf, itype_compass); | |
| 2427 |
2/4✓ Branch 0 taken 4818699 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4818699 times.
|
4818699 | if(itemid > -1 && checkbunny(itemid)) |
| 2428 | 4818699 | tile+=itemsbuf[itemid].ltm; | |
| 2429 | 4818699 | } | |
| 2430 | |||
| 2431 |
2/2✓ Branch 0 taken 3421266 times.
✓ Branch 1 taken 2630545 times.
|
6051811 | if(current_item(itype_bosskey)) |
| 2432 | { | ||
| 2433 | 2630545 | int32_t itemid = | |
| 2434 |
1/2✓ Branch 0 taken 2630545 times.
✗ Branch 1 not taken.
|
2630545 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2435 | ? iBossKey | ||
| 2436 | ✗ | : getHighestLevelEvenUnowned(itemsbuf, itype_bosskey); | |
| 2437 |
2/4✓ Branch 0 taken 2630545 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2630545 times.
|
2630545 | if(itemid > -1 && checkbunny(itemid)) |
| 2438 | 2630545 | tile+=itemsbuf[itemid].ltm; | |
| 2439 | 2630545 | } | |
| 2440 | |||
| 2441 |
2/2✓ Branch 0 taken 2917835 times.
✓ Branch 1 taken 3133976 times.
|
6051811 | if(current_item(itype_magiccontainer)) |
| 2442 | { | ||
| 2443 | 3133976 | int32_t itemid = | |
| 2444 |
2/2✓ Branch 0 taken 3040989 times.
✓ Branch 1 taken 92987 times.
|
3133976 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2445 | ? iMagicC | ||
| 2446 | 92987 | : getHighestLevelEvenUnowned(itemsbuf, itype_magiccontainer); | |
| 2447 |
3/4✓ Branch 0 taken 3133976 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1870 times.
✓ Branch 3 taken 3132106 times.
|
3133976 | if(itemid > -1 && checkbunny(itemid)) |
| 2448 | 3132106 | tile+=itemsbuf[itemid].ltm; | |
| 2449 | 3133976 | } | |
| 2450 | |||
| 2451 |
2/2✓ Branch 0 taken 1591177 times.
✓ Branch 1 taken 4460634 times.
|
6051811 | if(current_item(itype_triforcepiece)) |
| 2452 | { | ||
| 2453 | 4460634 | int32_t itemid = | |
| 2454 |
1/2✓ Branch 0 taken 4460634 times.
✗ Branch 1 not taken.
|
4460634 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2455 | ? iTriforce | ||
| 2456 | ✗ | : getHighestLevelEvenUnowned(itemsbuf, itype_triforcepiece); | |
| 2457 |
2/4✓ Branch 0 taken 4460634 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4460634 times.
|
4460634 | if(itemid > -1 && checkbunny(itemid)) |
| 2458 | 4460634 | tile+=itemsbuf[itemid].ltm; | |
| 2459 | 4460634 | } | |
| 2460 | |||
| 2461 |
2/2✓ Branch 0 taken 6051811 times.
✓ Branch 1 taken 3098527232 times.
|
3104579043 | for(int32_t i=0; i<itype_max; i++) |
| 2462 | { | ||
| 2463 |
2/2✓ Branch 0 taken 3042451456 times.
✓ Branch 1 taken 56075776 times.
|
3098527232 | if(!get_qr(qr_HARDCODED_LITEM_LTMS)) |
| 2464 | { | ||
| 2465 |
2/2✓ Branch 0 taken 1095230 times.
✓ Branch 1 taken 54980546 times.
|
56075776 | switch(i) |
| 2466 | { | ||
| 2467 | case itype_bomb: | ||
| 2468 | case itype_sbomb: | ||
| 2469 | case itype_clock: | ||
| 2470 | case itype_key: | ||
| 2471 | case itype_lkey: | ||
| 2472 | case itype_map: | ||
| 2473 | case itype_compass: | ||
| 2474 | case itype_bosskey: | ||
| 2475 | case itype_magiccontainer: | ||
| 2476 | case itype_triforcepiece: | ||
| 2477 | 1095230 | continue; //already handled | |
| 2478 | } | ||
| 2479 | 54980546 | } | |
| 2480 | 3097432002 | int32_t itemid = current_item_id(i,false); | |
| 2481 |
2/2✓ Branch 0 taken 3091380191 times.
✓ Branch 1 taken 6051811 times.
|
3097432002 | if(i == itype_shield) |
| 2482 | 6051811 | itemid = getCurrentShield(false); | |
| 2483 | |||
| 2484 |
4/4✓ Branch 0 taken 80852133 times.
✓ Branch 1 taken 3016579869 times.
✓ Branch 2 taken 100981 times.
✓ Branch 3 taken 80751152 times.
|
3097432002 | if(itemid < 0 || !checkbunny(itemid)) |
| 2485 | 3016680850 | continue; | |
| 2486 | |||
| 2487 | 80751152 | itemdata const& itm = itemsbuf[itemid]; | |
| 2488 | |||
| 2489 |
2/2✓ Branch 0 taken 75336675 times.
✓ Branch 1 taken 5414477 times.
|
80751152 | switch(itm.family) |
| 2490 | { | ||
| 2491 | case itype_shield: | ||
| 2492 |
1/2✓ Branch 0 taken 5414477 times.
✗ Branch 1 not taken.
|
5414477 | if(itm.flags & ITEM_FLAG9) //active shield |
| 2493 | { | ||
| 2494 | ✗ | if(!usingActiveShield(itemid)) | |
| 2495 | { | ||
| 2496 | ✗ | tile+=itm.misc6; //'Inactive PTM' | |
| 2497 | ✗ | continue; | |
| 2498 | } | ||
| 2499 | ✗ | } | |
| 2500 | 5414477 | break; | |
| 2501 | } | ||
| 2502 | |||
| 2503 | 80751152 | tile+=itm.ltm; | |
| 2504 | 80751152 | } | |
| 2505 | |||
| 2506 | 6051811 | return tile; | |
| 2507 | } | ||
| 2508 | |||
| 2509 | 6051811 | int32_t bunny_tile_mod() | |
| 2510 | { | ||
| 2511 |
2/2✓ Branch 0 taken 1870 times.
✓ Branch 1 taken 6049941 times.
|
6051811 | if(Hero.BunnyClock()) |
| 2512 | { | ||
| 2513 | 1870 | return game->get_bunny_ltm(); | |
| 2514 | } | ||
| 2515 | 6049941 | return 0; | |
| 2516 | 6051811 | } | |
| 2517 | |||
| 2518 | // Hints are drawn on a separate layer to combo reveals. | ||
| 2519 | 16332 | void draw_lens_under(BITMAP *dest, bool layer) | |
| 2520 | { | ||
| 2521 | //Lens flag 1: Replacement for qr_LENSHINTS; if set, lens will show hints. Does nothing if flag 2 is set. | ||
| 2522 | //Lens flag 2: Disable "hints", prevent rendering of Secret Combos | ||
| 2523 | //Lens flag 3: Don't show armos/chest/dive items | ||
| 2524 | //Lens flag 4: Show Raft Paths | ||
| 2525 | //Lens flag 5: Show Invisible Enemies | ||
| 2526 |
4/4✓ Branch 0 taken 456 times.
✓ Branch 1 taken 15876 times.
✓ Branch 2 taken 7938 times.
✓ Branch 3 taken 7938 times.
|
16332 | bool hints = (itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2) ? false : (layer && (itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG1)); |
| 2527 | |||
| 2528 | 16332 | int32_t strike_hint_table[11]= | |
| 2529 | { | ||
| 2530 | mfARROW, mfBOMB, mfBRANG, mfWANDMAGIC, | ||
| 2531 | mfSWORD, mfREFMAGIC, mfHOOKSHOT, | ||
| 2532 | mfREFFIREBALL, mfHAMMER, mfSWORDBEAM, mfWAND | ||
| 2533 | }; | ||
| 2534 | |||
| 2535 | // int32_t page = tmpscr->cpage; | ||
| 2536 | { | ||
| 2537 | 16332 | int32_t blink_rate=flash_reduction_enabled()?6:1; | |
| 2538 | // int32_t temptimer=0; | ||
| 2539 | 16332 | int32_t tempitem, tempweapon=0; | |
| 2540 | 16332 | strike_hint=strike_hint_table[strike_hint_counter]; | |
| 2541 | |||
| 2542 |
2/2✓ Branch 0 taken 15840 times.
✓ Branch 1 taken 492 times.
|
16332 | if(strike_hint_timer>32) |
| 2543 | { | ||
| 2544 | 492 | strike_hint_timer=0; | |
| 2545 | 492 | strike_hint_counter=((strike_hint_counter+1)%11); | |
| 2546 | 492 | } | |
| 2547 | |||
| 2548 | 16332 | ++strike_hint_timer; | |
| 2549 | |||
| 2550 |
2/2✓ Branch 0 taken 2874432 times.
✓ Branch 1 taken 16332 times.
|
2890764 | for(int32_t i=0; i<176; i++) |
| 2551 | { | ||
| 2552 | 2874432 | int32_t x = (i & 15) << 4; | |
| 2553 | 2874432 | int32_t y = (i & 0xF0) + playing_field_offset; | |
| 2554 | 2874432 | int32_t tempitemx=-16, tempitemy=-16; | |
| 2555 | 2874432 | int32_t tempweaponx=-16, tempweapony=-16; | |
| 2556 | |||
| 2557 |
2/2✓ Branch 0 taken 5748864 times.
✓ Branch 1 taken 2874432 times.
|
8623296 | for(int32_t iter=0; iter<2; ++iter) |
| 2558 | { | ||
| 2559 | 5748864 | int32_t checkflag=0; | |
| 2560 | |||
| 2561 |
2/2✓ Branch 0 taken 2874432 times.
✓ Branch 1 taken 2874432 times.
|
5748864 | if(iter==0) |
| 2562 | { | ||
| 2563 | 2874432 | checkflag=combobuf[tmpscr->data[i]].flag; | |
| 2564 | 2874432 | } | |
| 2565 | else | ||
| 2566 | { | ||
| 2567 | 2874432 | checkflag=tmpscr->sflag[i]; | |
| 2568 | } | ||
| 2569 | |||
| 2570 |
2/2✓ Branch 0 taken 5747766 times.
✓ Branch 1 taken 1098 times.
|
5748864 | if(checkflag==mfSTRIKE) |
| 2571 | { | ||
| 2572 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 906 times.
|
1098 | if(!hints) |
| 2573 | { | ||
| 2574 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 906 times.
|
906 | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sSTRIKE],tmpscr->secretcset[sSTRIKE]); |
| 2575 | 906 | } | |
| 2576 | else | ||
| 2577 | { | ||
| 2578 | 192 | checkflag = strike_hint; | |
| 2579 | } | ||
| 2580 | 1098 | } | |
| 2581 | |||
| 2582 |
20/36✓ Branch 0 taken 5706470 times.
✓ Branch 1 taken 3148 times.
✓ Branch 2 taken 3618 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2064 times.
✓ Branch 5 taken 28640 times.
✓ Branch 6 taken 2418 times.
✓ Branch 7 taken 504 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 814 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 33 times.
✓ Branch 15 taken 96 times.
✓ Branch 16 taken 24 times.
✓ Branch 17 taken 5 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 16 times.
✓ Branch 22 taken 16 times.
✓ Branch 23 taken 7 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 16 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 17 times.
✓ Branch 32 taken 35 times.
✓ Branch 33 taken 17 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 906 times.
|
5748864 | switch(checkflag) |
| 2583 | { | ||
| 2584 | case 0: | ||
| 2585 | case mfZELDA: | ||
| 2586 | case mfPUSHED: | ||
| 2587 | case mfENEMY0: | ||
| 2588 | case mfENEMY1: | ||
| 2589 | case mfENEMY2: | ||
| 2590 | case mfENEMY3: | ||
| 2591 | case mfENEMY4: | ||
| 2592 | case mfENEMY5: | ||
| 2593 | case mfENEMY6: | ||
| 2594 | case mfENEMY7: | ||
| 2595 | case mfENEMY8: | ||
| 2596 | case mfENEMY9: | ||
| 2597 | case mfSINGLE: | ||
| 2598 | case mfSINGLE16: | ||
| 2599 | case mfNOENEMY: | ||
| 2600 | case mfTRAP_H: | ||
| 2601 | case mfTRAP_V: | ||
| 2602 | case mfTRAP_4: | ||
| 2603 | case mfTRAP_LR: | ||
| 2604 | case mfTRAP_UD: | ||
| 2605 | case mfNOGROUNDENEMY: | ||
| 2606 | case mfNOBLOCKS: | ||
| 2607 | case mfSCRIPT1: | ||
| 2608 | case mfSCRIPT2: | ||
| 2609 | case mfSCRIPT3: | ||
| 2610 | case mfSCRIPT4: | ||
| 2611 | case mfSCRIPT5: | ||
| 2612 | case mfSCRIPT6: | ||
| 2613 | case mfSCRIPT7: | ||
| 2614 | case mfSCRIPT8: | ||
| 2615 | case mfSCRIPT9: | ||
| 2616 | case mfSCRIPT10: | ||
| 2617 | case mfSCRIPT11: | ||
| 2618 | case mfSCRIPT12: | ||
| 2619 | case mfSCRIPT13: | ||
| 2620 | case mfSCRIPT14: | ||
| 2621 | case mfSCRIPT15: | ||
| 2622 | case mfSCRIPT16: | ||
| 2623 | case mfSCRIPT17: | ||
| 2624 | case mfSCRIPT18: | ||
| 2625 | case mfSCRIPT19: | ||
| 2626 | case mfSCRIPT20: | ||
| 2627 | case mfPITHOLE: | ||
| 2628 | case mfPITFALLFLOOR: | ||
| 2629 | case mfLAVA: | ||
| 2630 | case mfICE: | ||
| 2631 | case mfICEDAMAGE: | ||
| 2632 | case mfDAMAGE1: | ||
| 2633 | case mfDAMAGE2: | ||
| 2634 | case mfDAMAGE4: | ||
| 2635 | case mfDAMAGE8: | ||
| 2636 | case mfDAMAGE16: | ||
| 2637 | case mfDAMAGE32: | ||
| 2638 | case mfFREEZEALL: | ||
| 2639 | case mfFREZEALLANSFFCS: | ||
| 2640 | case mfFREEZEFFCSOLY: | ||
| 2641 | case mfSCRITPTW1TRIG: | ||
| 2642 | case mfSCRITPTW2TRIG: | ||
| 2643 | case mfSCRITPTW3TRIG: | ||
| 2644 | case mfSCRITPTW4TRIG: | ||
| 2645 | case mfSCRITPTW5TRIG: | ||
| 2646 | case mfSCRITPTW6TRIG: | ||
| 2647 | case mfSCRITPTW7TRIG: | ||
| 2648 | case mfSCRITPTW8TRIG: | ||
| 2649 | case mfSCRITPTW9TRIG: | ||
| 2650 | case mfSCRITPTW10TRIG: | ||
| 2651 | case mfTROWEL: | ||
| 2652 | case mfTROWELNEXT: | ||
| 2653 | case mfTROWELSPECIALITEM: | ||
| 2654 | case mfSLASHPOT: | ||
| 2655 | case mfLIFTPOT: | ||
| 2656 | case mfLIFTORSLASH: | ||
| 2657 | case mfLIFTROCK: | ||
| 2658 | case mfLIFTROCKHEAVY: | ||
| 2659 | case mfDROPITEM: | ||
| 2660 | case mfSPECIALITEM: | ||
| 2661 | case mfDROPKEY: | ||
| 2662 | case mfDROPLKEY: | ||
| 2663 | case mfDROPCOMPASS: | ||
| 2664 | case mfDROPMAP: | ||
| 2665 | case mfDROPBOSSKEY: | ||
| 2666 | case mfSPAWNNPC: | ||
| 2667 | case mfSWITCHHOOK: | ||
| 2668 | case mfSIDEVIEWLADDER: | ||
| 2669 | case mfSIDEVIEWPLATFORM: | ||
| 2670 | case mfNOENEMYSPAWN: | ||
| 2671 | case mfENEMYALL: | ||
| 2672 | case mfNOMIRROR: | ||
| 2673 | case mfUNSAFEGROUND: | ||
| 2674 | case mf168: | ||
| 2675 | case mf169: | ||
| 2676 | case mf170: | ||
| 2677 | case mf171: | ||
| 2678 | case mf172: | ||
| 2679 | case mf173: | ||
| 2680 | case mf174: | ||
| 2681 | case mf175: | ||
| 2682 | case mf176: | ||
| 2683 | case mf177: | ||
| 2684 | case mf178: | ||
| 2685 | case mf179: | ||
| 2686 | case mf180: | ||
| 2687 | case mf181: | ||
| 2688 | case mf182: | ||
| 2689 | case mf183: | ||
| 2690 | case mf184: | ||
| 2691 | case mf185: | ||
| 2692 | case mf186: | ||
| 2693 | case mf187: | ||
| 2694 | case mf188: | ||
| 2695 | case mf189: | ||
| 2696 | case mf190: | ||
| 2697 | case mf191: | ||
| 2698 | case mf192: | ||
| 2699 | case mf193: | ||
| 2700 | case mf194: | ||
| 2701 | case mf195: | ||
| 2702 | case mf196: | ||
| 2703 | case mf197: | ||
| 2704 | case mf198: | ||
| 2705 | case mf199: | ||
| 2706 | case mf200: | ||
| 2707 | case mf201: | ||
| 2708 | case mf202: | ||
| 2709 | case mf203: | ||
| 2710 | case mf204: | ||
| 2711 | case mf205: | ||
| 2712 | case mf206: | ||
| 2713 | case mf207: | ||
| 2714 | case mf208: | ||
| 2715 | case mf209: | ||
| 2716 | case mf210: | ||
| 2717 | case mf211: | ||
| 2718 | case mf212: | ||
| 2719 | case mf213: | ||
| 2720 | case mf214: | ||
| 2721 | case mf215: | ||
| 2722 | case mf216: | ||
| 2723 | case mf217: | ||
| 2724 | case mf218: | ||
| 2725 | case mf219: | ||
| 2726 | case mf220: | ||
| 2727 | case mf221: | ||
| 2728 | case mf222: | ||
| 2729 | case mf223: | ||
| 2730 | case mf224: | ||
| 2731 | case mf225: | ||
| 2732 | case mf226: | ||
| 2733 | case mf227: | ||
| 2734 | case mf228: | ||
| 2735 | case mf229: | ||
| 2736 | case mf230: | ||
| 2737 | case mf231: | ||
| 2738 | case mf232: | ||
| 2739 | case mf233: | ||
| 2740 | case mf234: | ||
| 2741 | case mf235: | ||
| 2742 | case mf236: | ||
| 2743 | case mf237: | ||
| 2744 | case mf238: | ||
| 2745 | case mf239: | ||
| 2746 | case mf240: | ||
| 2747 | case mf241: | ||
| 2748 | case mf242: | ||
| 2749 | case mf243: | ||
| 2750 | case mf244: | ||
| 2751 | case mf245: | ||
| 2752 | case mf246: | ||
| 2753 | case mf247: | ||
| 2754 | case mf248: | ||
| 2755 | case mf249: | ||
| 2756 | case mf250: | ||
| 2757 | case mf251: | ||
| 2758 | case mf252: | ||
| 2759 | case mf253: | ||
| 2760 | case mf254: | ||
| 2761 | case mfEXTENDED: | ||
| 2762 | 5706470 | break; | |
| 2763 | |||
| 2764 | case mfPUSHUD: | ||
| 2765 | case mfPUSHLR: | ||
| 2766 | case mfPUSH4: | ||
| 2767 | case mfPUSHU: | ||
| 2768 | case mfPUSHD: | ||
| 2769 | case mfPUSHL: | ||
| 2770 | case mfPUSHR: | ||
| 2771 | case mfPUSHUDNS: | ||
| 2772 | case mfPUSHLRNS: | ||
| 2773 | case mfPUSH4NS: | ||
| 2774 | case mfPUSHUNS: | ||
| 2775 | case mfPUSHDNS: | ||
| 2776 | case mfPUSHLNS: | ||
| 2777 | case mfPUSHRNS: | ||
| 2778 | case mfPUSHUDINS: | ||
| 2779 | case mfPUSHLRINS: | ||
| 2780 | case mfPUSH4INS: | ||
| 2781 | case mfPUSHUINS: | ||
| 2782 | case mfPUSHDINS: | ||
| 2783 | case mfPUSHLINS: | ||
| 2784 | case mfPUSHRINS: | ||
| 2785 |
3/4✓ Branch 0 taken 1829 times.
✓ Branch 1 taken 1319 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1829 times.
|
3148 | if(!hints && ((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&16)) |
| 2786 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 1829 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1829 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1829 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&16)))) |
| 2787 | { | ||
| 2788 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->undercombo,tmpscr->undercset); | |
| 2789 | ✗ | } | |
| 2790 | |||
| 2791 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3148 times.
|
3148 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2792 |
3/6✓ Branch 0 taken 2438 times.
✓ Branch 1 taken 710 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 710 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
3148 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2793 | { | ||
| 2794 |
2/2✓ Branch 0 taken 1406 times.
✓ Branch 1 taken 1032 times.
|
2438 | if(hints) |
| 2795 | { | ||
| 2796 |
3/3✓ Branch 0 taken 72 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 897 times.
|
1032 | switch(combobuf[tmpscr->data[i]].type) |
| 2797 | { | ||
| 2798 | case cPUSH_HEAVY: | ||
| 2799 | case cPUSH_HW: | ||
| 2800 | 72 | tempitem=getItemIDPower(itemsbuf,itype_bracelet,1); | |
| 2801 | 72 | tempitemx=x, tempitemy=y; | |
| 2802 | |||
| 2803 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
|
72 | if(tempitem>-1) |
| 2804 | 72 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2805 | |||
| 2806 | 72 | break; | |
| 2807 | |||
| 2808 | case cPUSH_HEAVY2: | ||
| 2809 | case cPUSH_HW2: | ||
| 2810 | 63 | tempitem=getItemIDPower(itemsbuf,itype_bracelet,2); | |
| 2811 | 63 | tempitemx=x, tempitemy=y; | |
| 2812 | |||
| 2813 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(tempitem>-1) |
| 2814 | 63 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2815 | |||
| 2816 | 63 | break; | |
| 2817 | } | ||
| 2818 | 1032 | } | |
| 2819 | 2438 | } | |
| 2820 | |||
| 2821 | 3148 | break; | |
| 2822 | |||
| 2823 | case mfWHISTLE: | ||
| 2824 |
1/2✓ Branch 0 taken 2418 times.
✗ Branch 1 not taken.
|
2418 | if(hints) |
| 2825 | { | ||
| 2826 | ✗ | tempitem=getItemID(itemsbuf,itype_whistle,1); | |
| 2827 | |||
| 2828 | ✗ | if(tempitem<0) break; | |
| 2829 | |||
| 2830 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2831 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2832 | { | ||
| 2833 | ✗ | tempitemx=x; | |
| 2834 | ✗ | tempitemy=y; | |
| 2835 | ✗ | } | |
| 2836 | |||
| 2837 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2838 | ✗ | } | |
| 2839 | |||
| 2840 | 2418 | break; | |
| 2841 | |||
| 2842 | //Why is this here? | ||
| 2843 | case mfFAIRY: | ||
| 2844 | case mfMAGICFAIRY: | ||
| 2845 | case mfALLFAIRY: | ||
| 2846 | ✗ | if(hints) | |
| 2847 | { | ||
| 2848 | ✗ | tempitem=getItemID(itemsbuf, itype_fairy,1);//iFairyMoving; | |
| 2849 | |||
| 2850 | ✗ | if(tempitem < 0) break; | |
| 2851 | |||
| 2852 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2853 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2854 | { | ||
| 2855 | ✗ | tempitemx=x; | |
| 2856 | ✗ | tempitemy=y; | |
| 2857 | ✗ | } | |
| 2858 | |||
| 2859 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2860 | ✗ | } | |
| 2861 | |||
| 2862 | ✗ | break; | |
| 2863 | |||
| 2864 | case mfANYFIRE: | ||
| 2865 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 252 times.
|
504 | if(!hints) |
| 2866 | { | ||
| 2867 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 252 times.
|
252 | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sBCANDLE],tmpscr->secretcset[sBCANDLE]); |
| 2868 | 252 | } | |
| 2869 | else | ||
| 2870 | { | ||
| 2871 | 252 | tempitem=getItemID(itemsbuf,itype_candle,1); | |
| 2872 | |||
| 2873 |
1/2✓ Branch 0 taken 252 times.
✗ Branch 1 not taken.
|
252 | if(tempitem<0) break; |
| 2874 | |||
| 2875 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 252 times.
|
252 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2876 |
3/6✓ Branch 0 taken 189 times.
✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 63 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
252 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2877 | { | ||
| 2878 | 189 | tempitemx=x; | |
| 2879 | 189 | tempitemy=y; | |
| 2880 | 189 | } | |
| 2881 | |||
| 2882 | 252 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2883 | } | ||
| 2884 | |||
| 2885 | 504 | break; | |
| 2886 | |||
| 2887 | case mfSTRONGFIRE: | ||
| 2888 | ✗ | if(!hints) | |
| 2889 | { | ||
| 2890 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sRCANDLE],tmpscr->secretcset[sRCANDLE]); | |
| 2891 | ✗ | } | |
| 2892 | else | ||
| 2893 | { | ||
| 2894 | ✗ | tempitem=getItemID(itemsbuf,itype_candle,2); | |
| 2895 | |||
| 2896 | ✗ | if(tempitem<0) break; | |
| 2897 | |||
| 2898 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2899 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2900 | { | ||
| 2901 | ✗ | tempitemx=x; | |
| 2902 | ✗ | tempitemy=y; | |
| 2903 | ✗ | } | |
| 2904 | |||
| 2905 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2906 | } | ||
| 2907 | |||
| 2908 | ✗ | break; | |
| 2909 | |||
| 2910 | case mfMAGICFIRE: | ||
| 2911 | ✗ | if(!hints) | |
| 2912 | { | ||
| 2913 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sWANDFIRE],tmpscr->secretcset[sWANDFIRE]); | |
| 2914 | ✗ | } | |
| 2915 | else | ||
| 2916 | { | ||
| 2917 | ✗ | tempitem=getItemID(itemsbuf,itype_wand,1); | |
| 2918 | |||
| 2919 | ✗ | if(tempitem<0) break; | |
| 2920 | |||
| 2921 | ✗ | tempweapon=wFire; | |
| 2922 | |||
| 2923 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2924 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2925 | { | ||
| 2926 | ✗ | tempitemx=x; | |
| 2927 | ✗ | tempitemy=y; | |
| 2928 | ✗ | } | |
| 2929 | else | ||
| 2930 | { | ||
| 2931 | ✗ | tempweaponx=x; | |
| 2932 | ✗ | tempweapony=y; | |
| 2933 | } | ||
| 2934 | |||
| 2935 | ✗ | putweapon(dest,tempweaponx,tempweapony,tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 2936 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2937 | } | ||
| 2938 | |||
| 2939 | ✗ | break; | |
| 2940 | |||
| 2941 | case mfDIVINEFIRE: | ||
| 2942 | ✗ | if(!hints) | |
| 2943 | { | ||
| 2944 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sDIVINEFIRE],tmpscr->secretcset[sDIVINEFIRE]); | |
| 2945 | ✗ | } | |
| 2946 | else | ||
| 2947 | { | ||
| 2948 | ✗ | tempitem=getItemID(itemsbuf,itype_divinefire,1); | |
| 2949 | |||
| 2950 | ✗ | if(tempitem<0) break; | |
| 2951 | |||
| 2952 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2953 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2954 | { | ||
| 2955 | ✗ | tempitemx=x; | |
| 2956 | ✗ | tempitemy=y; | |
| 2957 | ✗ | } | |
| 2958 | |||
| 2959 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2960 | } | ||
| 2961 | |||
| 2962 | ✗ | break; | |
| 2963 | |||
| 2964 | case mfARROW: | ||
| 2965 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 732 times.
|
814 | if(!hints) |
| 2966 | { | ||
| 2967 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 732 times.
|
732 | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sARROW],tmpscr->secretcset[sARROW]); |
| 2968 | 732 | } | |
| 2969 | else | ||
| 2970 | { | ||
| 2971 | 82 | tempitem=getItemID(itemsbuf,itype_arrow,1); | |
| 2972 | |||
| 2973 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if(tempitem<0) break; |
| 2974 | |||
| 2975 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2976 |
3/6✓ Branch 0 taken 61 times.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
82 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2977 | { | ||
| 2978 | 61 | tempitemx=x; | |
| 2979 | 61 | tempitemy=y; | |
| 2980 | 61 | } | |
| 2981 | |||
| 2982 | 82 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2983 | } | ||
| 2984 | |||
| 2985 | 814 | break; | |
| 2986 | |||
| 2987 | case mfSARROW: | ||
| 2988 | ✗ | if(!hints) | |
| 2989 | { | ||
| 2990 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sSARROW],tmpscr->secretcset[sSARROW]); | |
| 2991 | ✗ | } | |
| 2992 | else | ||
| 2993 | { | ||
| 2994 | ✗ | tempitem=getItemID(itemsbuf,itype_arrow,2); | |
| 2995 | |||
| 2996 | ✗ | if(tempitem<0) break; | |
| 2997 | |||
| 2998 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2999 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3000 | { | ||
| 3001 | ✗ | tempitemx=x; | |
| 3002 | ✗ | tempitemy=y; | |
| 3003 | ✗ | } | |
| 3004 | |||
| 3005 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3006 | } | ||
| 3007 | |||
| 3008 | ✗ | break; | |
| 3009 | |||
| 3010 | case mfGARROW: | ||
| 3011 | ✗ | if(!hints) | |
| 3012 | { | ||
| 3013 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sGARROW],tmpscr->secretcset[sGARROW]); | |
| 3014 | ✗ | } | |
| 3015 | else | ||
| 3016 | { | ||
| 3017 | ✗ | tempitem=getItemID(itemsbuf,itype_arrow,3); | |
| 3018 | |||
| 3019 | ✗ | if(tempitem<0) break; | |
| 3020 | |||
| 3021 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3022 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3023 | { | ||
| 3024 | ✗ | tempitemx=x; | |
| 3025 | ✗ | tempitemy=y; | |
| 3026 | ✗ | } | |
| 3027 | |||
| 3028 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3029 | } | ||
| 3030 | |||
| 3031 | ✗ | break; | |
| 3032 | |||
| 3033 | case mfBOMB: | ||
| 3034 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 16 times.
|
33 | if(!hints) |
| 3035 | { | ||
| 3036 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sBOMB],tmpscr->secretcset[sBOMB]); |
| 3037 | 16 | } | |
| 3038 | else | ||
| 3039 | { | ||
| 3040 | //tempitem=getItemID(itemsbuf,itype_bomb,1); | ||
| 3041 | 17 | tempweapon = wLitBomb; | |
| 3042 | |||
| 3043 | //if (tempitem<0) break; | ||
| 3044 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3045 |
3/6✓ Branch 0 taken 12 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3046 | { | ||
| 3047 | 12 | tempweaponx=x; | |
| 3048 | 12 | tempweapony=y; | |
| 3049 | 12 | } | |
| 3050 | |||
| 3051 | 17 | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 3052 | } | ||
| 3053 | |||
| 3054 | 33 | break; | |
| 3055 | |||
| 3056 | case mfSBOMB: | ||
| 3057 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 48 times.
|
96 | if(!hints) |
| 3058 | { | ||
| 3059 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sSBOMB],tmpscr->secretcset[sSBOMB]); |
| 3060 | 48 | } | |
| 3061 | else | ||
| 3062 | { | ||
| 3063 | //tempitem=getItemID(itemsbuf,itype_sbomb,1); | ||
| 3064 | //if (tempitem<0) break; | ||
| 3065 | 48 | tempweapon = wLitSBomb; | |
| 3066 | |||
| 3067 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3068 |
3/6✓ Branch 0 taken 36 times.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
48 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3069 | { | ||
| 3070 | 36 | tempweaponx=x; | |
| 3071 | 36 | tempweapony=y; | |
| 3072 | 36 | } | |
| 3073 | |||
| 3074 | 48 | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 3075 | } | ||
| 3076 | |||
| 3077 | 96 | break; | |
| 3078 | |||
| 3079 | case mfARMOS_SECRET: | ||
| 3080 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 12 times.
|
24 | if(!hints) |
| 3081 | { | ||
| 3082 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sSTAIRS],tmpscr->secretcset[sSTAIRS]); |
| 3083 | 12 | } | |
| 3084 | 24 | break; | |
| 3085 | |||
| 3086 | case mfBRANG: | ||
| 3087 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(!hints) |
| 3088 | { | ||
| 3089 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sBRANG],tmpscr->secretcset[sBRANG]); | |
| 3090 | ✗ | } | |
| 3091 | else | ||
| 3092 | { | ||
| 3093 | 5 | tempitem=getItemID(itemsbuf,itype_brang,1); | |
| 3094 | |||
| 3095 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(tempitem<0) break; |
| 3096 | |||
| 3097 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3098 |
3/6✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3099 | { | ||
| 3100 | 4 | tempitemx=x; | |
| 3101 | 4 | tempitemy=y; | |
| 3102 | 4 | } | |
| 3103 | |||
| 3104 | 5 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3105 | } | ||
| 3106 | |||
| 3107 | 5 | break; | |
| 3108 | |||
| 3109 | case mfMBRANG: | ||
| 3110 | ✗ | if(!hints) | |
| 3111 | { | ||
| 3112 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sMBRANG],tmpscr->secretcset[sMBRANG]); | |
| 3113 | ✗ | } | |
| 3114 | else | ||
| 3115 | { | ||
| 3116 | ✗ | tempitem=getItemID(itemsbuf,itype_brang,2); | |
| 3117 | |||
| 3118 | ✗ | if(tempitem<0) break; | |
| 3119 | |||
| 3120 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3121 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3122 | { | ||
| 3123 | ✗ | tempitemx=x; | |
| 3124 | ✗ | tempitemy=y; | |
| 3125 | ✗ | } | |
| 3126 | |||
| 3127 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3128 | } | ||
| 3129 | |||
| 3130 | ✗ | break; | |
| 3131 | |||
| 3132 | case mfFBRANG: | ||
| 3133 | ✗ | if(!hints) | |
| 3134 | { | ||
| 3135 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sFBRANG],tmpscr->secretcset[sFBRANG]); | |
| 3136 | ✗ | } | |
| 3137 | else | ||
| 3138 | { | ||
| 3139 | ✗ | tempitem=getItemID(itemsbuf,itype_brang,3); | |
| 3140 | |||
| 3141 | ✗ | if(tempitem<0) break; | |
| 3142 | |||
| 3143 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3144 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3145 | { | ||
| 3146 | ✗ | tempitemx=x; | |
| 3147 | ✗ | tempitemy=y; | |
| 3148 | ✗ | } | |
| 3149 | |||
| 3150 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3151 | } | ||
| 3152 | |||
| 3153 | ✗ | break; | |
| 3154 | |||
| 3155 | case mfWANDMAGIC: | ||
| 3156 | ✗ | if(!hints) | |
| 3157 | { | ||
| 3158 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sWANDMAGIC],tmpscr->secretcset[sWANDMAGIC]); | |
| 3159 | ✗ | } | |
| 3160 | else | ||
| 3161 | { | ||
| 3162 | ✗ | tempitem=getItemID(itemsbuf,itype_wand,1); | |
| 3163 | |||
| 3164 | ✗ | if(tempitem<0) break; | |
| 3165 | |||
| 3166 | ✗ | tempweapon=itemsbuf[tempitem].wpn3; | |
| 3167 | |||
| 3168 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3169 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3170 | { | ||
| 3171 | ✗ | tempitemx=x; | |
| 3172 | ✗ | tempitemy=y; | |
| 3173 | ✗ | } | |
| 3174 | else | ||
| 3175 | { | ||
| 3176 | ✗ | tempweaponx=x; | |
| 3177 | ✗ | tempweapony=y; | |
| 3178 | ✗ | --lens_hint_weapon[wMagic][4]; | |
| 3179 | |||
| 3180 | ✗ | if(lens_hint_weapon[wMagic][4]<-8) | |
| 3181 | { | ||
| 3182 | ✗ | lens_hint_weapon[wMagic][4]=8; | |
| 3183 | ✗ | } | |
| 3184 | } | ||
| 3185 | |||
| 3186 | ✗ | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 3187 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3188 | } | ||
| 3189 | |||
| 3190 | ✗ | break; | |
| 3191 | |||
| 3192 | case mfREFMAGIC: | ||
| 3193 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!hints) |
| 3194 | { | ||
| 3195 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sREFMAGIC],tmpscr->secretcset[sREFMAGIC]); | |
| 3196 | ✗ | } | |
| 3197 | else | ||
| 3198 | { | ||
| 3199 | 16 | tempitem=getItemID(itemsbuf,itype_shield,3); | |
| 3200 | |||
| 3201 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(tempitem<0) break; |
| 3202 | |||
| 3203 | 16 | tempweapon=ewMagic; | |
| 3204 | |||
| 3205 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3206 |
3/6✓ Branch 0 taken 13 times.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
16 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3207 | { | ||
| 3208 | 13 | tempitemx=x; | |
| 3209 | 13 | tempitemy=y; | |
| 3210 | 13 | } | |
| 3211 | else | ||
| 3212 | { | ||
| 3213 | 3 | tempweaponx=x; | |
| 3214 | 3 | tempweapony=y; | |
| 3215 | |||
| 3216 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | if(lens_hint_weapon[ewMagic][2]==up) |
| 3217 | { | ||
| 3218 | 1 | --lens_hint_weapon[ewMagic][4]; | |
| 3219 | 1 | } | |
| 3220 | else | ||
| 3221 | { | ||
| 3222 | 2 | ++lens_hint_weapon[ewMagic][4]; | |
| 3223 | } | ||
| 3224 | |||
| 3225 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if(lens_hint_weapon[ewMagic][4]>8) |
| 3226 | { | ||
| 3227 | ✗ | lens_hint_weapon[ewMagic][2]=up; | |
| 3228 | ✗ | } | |
| 3229 | |||
| 3230 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | if(lens_hint_weapon[ewMagic][4]<=0) |
| 3231 | { | ||
| 3232 | 2 | lens_hint_weapon[ewMagic][2]=down; | |
| 3233 | 2 | } | |
| 3234 | } | ||
| 3235 | |||
| 3236 | 16 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3237 | 16 | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, lens_hint_weapon[ewMagic][2], lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 3238 | } | ||
| 3239 | |||
| 3240 | 16 | break; | |
| 3241 | |||
| 3242 | case mfREFFIREBALL: | ||
| 3243 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!hints) |
| 3244 | { | ||
| 3245 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sREFFIREBALL],tmpscr->secretcset[sREFFIREBALL]); | |
| 3246 | ✗ | } | |
| 3247 | else | ||
| 3248 | { | ||
| 3249 | 16 | tempitem=getItemID(itemsbuf,itype_shield,3); | |
| 3250 | |||
| 3251 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(tempitem<0) break; |
| 3252 | |||
| 3253 | 16 | tempweapon=ewFireball; | |
| 3254 | |||
| 3255 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3256 |
3/6✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
16 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3257 | { | ||
| 3258 | 12 | tempitemx=x; | |
| 3259 | 12 | tempitemy=y; | |
| 3260 | 12 | tempweaponx=x; | |
| 3261 | 12 | tempweapony=y; | |
| 3262 | 12 | ++lens_hint_weapon[ewFireball][3]; | |
| 3263 | |||
| 3264 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 1 times.
|
12 | if(lens_hint_weapon[ewFireball][3]>8) |
| 3265 | { | ||
| 3266 | 1 | lens_hint_weapon[ewFireball][3]=-8; | |
| 3267 | 1 | lens_hint_weapon[ewFireball][4]=8; | |
| 3268 | 1 | } | |
| 3269 | |||
| 3270 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
|
12 | if(lens_hint_weapon[ewFireball][3]>0) |
| 3271 | { | ||
| 3272 | 8 | ++lens_hint_weapon[ewFireball][4]; | |
| 3273 | 8 | } | |
| 3274 | else | ||
| 3275 | { | ||
| 3276 | 4 | --lens_hint_weapon[ewFireball][4]; | |
| 3277 | } | ||
| 3278 | 12 | } | |
| 3279 | |||
| 3280 | 16 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3281 | 16 | putweapon(dest,tempweaponx+lens_hint_weapon[tempweapon][3],tempweapony+lens_hint_weapon[ewFireball][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 3282 | } | ||
| 3283 | |||
| 3284 | 16 | break; | |
| 3285 | |||
| 3286 | case mfSWORD: | ||
| 3287 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(!hints) |
| 3288 | { | ||
| 3289 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sSWORD],tmpscr->secretcset[sSWORD]); | |
| 3290 | ✗ | } | |
| 3291 | else | ||
| 3292 | { | ||
| 3293 | 7 | tempitem=getItemID(itemsbuf,itype_sword,1); | |
| 3294 | |||
| 3295 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(tempitem<0) break; |
| 3296 | |||
| 3297 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3298 |
3/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3299 | { | ||
| 3300 | 5 | tempitemx=x; | |
| 3301 | 5 | tempitemy=y; | |
| 3302 | 5 | } | |
| 3303 | |||
| 3304 | 7 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3305 | } | ||
| 3306 | |||
| 3307 | 7 | break; | |
| 3308 | |||
| 3309 | case mfWSWORD: | ||
| 3310 | ✗ | if(!hints) | |
| 3311 | { | ||
| 3312 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sWSWORD],tmpscr->secretcset[sWSWORD]); | |
| 3313 | ✗ | } | |
| 3314 | else | ||
| 3315 | { | ||
| 3316 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,2); | |
| 3317 | |||
| 3318 | ✗ | if(tempitem<0) break; | |
| 3319 | |||
| 3320 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3321 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3322 | { | ||
| 3323 | ✗ | tempitemx=x; | |
| 3324 | ✗ | tempitemy=y; | |
| 3325 | ✗ | } | |
| 3326 | |||
| 3327 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3328 | } | ||
| 3329 | |||
| 3330 | ✗ | break; | |
| 3331 | |||
| 3332 | case mfMSWORD: | ||
| 3333 | ✗ | if(!hints) | |
| 3334 | { | ||
| 3335 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sMSWORD],tmpscr->secretcset[sMSWORD]); | |
| 3336 | ✗ | } | |
| 3337 | else | ||
| 3338 | { | ||
| 3339 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,3); | |
| 3340 | |||
| 3341 | ✗ | if(tempitem<0) break; | |
| 3342 | |||
| 3343 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3344 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3345 | { | ||
| 3346 | ✗ | tempitemx=x; | |
| 3347 | ✗ | tempitemy=y; | |
| 3348 | ✗ | } | |
| 3349 | |||
| 3350 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3351 | } | ||
| 3352 | |||
| 3353 | ✗ | break; | |
| 3354 | |||
| 3355 | case mfXSWORD: | ||
| 3356 | ✗ | if(!hints) | |
| 3357 | { | ||
| 3358 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sXSWORD],tmpscr->secretcset[sXSWORD]); | |
| 3359 | ✗ | } | |
| 3360 | else | ||
| 3361 | { | ||
| 3362 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,4); | |
| 3363 | |||
| 3364 | ✗ | if(tempitem<0) break; | |
| 3365 | |||
| 3366 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3367 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3368 | { | ||
| 3369 | ✗ | tempitemx=x; | |
| 3370 | ✗ | tempitemy=y; | |
| 3371 | ✗ | } | |
| 3372 | |||
| 3373 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3374 | } | ||
| 3375 | |||
| 3376 | ✗ | break; | |
| 3377 | |||
| 3378 | case mfSWORDBEAM: | ||
| 3379 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!hints) |
| 3380 | { | ||
| 3381 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sSWORDBEAM],tmpscr->secretcset[sSWORDBEAM]); | |
| 3382 | ✗ | } | |
| 3383 | else | ||
| 3384 | { | ||
| 3385 | 16 | tempitem=getItemID(itemsbuf,itype_sword,1); | |
| 3386 | |||
| 3387 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(tempitem<0) break; |
| 3388 | |||
| 3389 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3390 |
3/6✓ Branch 0 taken 11 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
16 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3391 | { | ||
| 3392 | 11 | tempitemx=x; | |
| 3393 | 11 | tempitemy=y; | |
| 3394 | 11 | } | |
| 3395 | |||
| 3396 | 16 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 1); | |
| 3397 | } | ||
| 3398 | |||
| 3399 | 16 | break; | |
| 3400 | |||
| 3401 | case mfWSWORDBEAM: | ||
| 3402 | ✗ | if(!hints) | |
| 3403 | { | ||
| 3404 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sWSWORDBEAM],tmpscr->secretcset[sWSWORDBEAM]); | |
| 3405 | ✗ | } | |
| 3406 | else | ||
| 3407 | { | ||
| 3408 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,2); | |
| 3409 | |||
| 3410 | ✗ | if(tempitem<0) break; | |
| 3411 | |||
| 3412 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3413 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3414 | { | ||
| 3415 | ✗ | tempitemx=x; | |
| 3416 | ✗ | tempitemy=y; | |
| 3417 | ✗ | } | |
| 3418 | |||
| 3419 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 2); | |
| 3420 | } | ||
| 3421 | |||
| 3422 | ✗ | break; | |
| 3423 | |||
| 3424 | case mfMSWORDBEAM: | ||
| 3425 | ✗ | if(!hints) | |
| 3426 | { | ||
| 3427 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sMSWORDBEAM],tmpscr->secretcset[sMSWORDBEAM]); | |
| 3428 | ✗ | } | |
| 3429 | else | ||
| 3430 | { | ||
| 3431 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,3); | |
| 3432 | |||
| 3433 | ✗ | if(tempitem<0) break; | |
| 3434 | |||
| 3435 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3436 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3437 | { | ||
| 3438 | ✗ | tempitemx=x; | |
| 3439 | ✗ | tempitemy=y; | |
| 3440 | ✗ | } | |
| 3441 | |||
| 3442 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 3); | |
| 3443 | } | ||
| 3444 | |||
| 3445 | ✗ | break; | |
| 3446 | |||
| 3447 | case mfXSWORDBEAM: | ||
| 3448 | ✗ | if(!hints) | |
| 3449 | { | ||
| 3450 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sXSWORDBEAM],tmpscr->secretcset[sXSWORDBEAM]); | |
| 3451 | ✗ | } | |
| 3452 | else | ||
| 3453 | { | ||
| 3454 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,4); | |
| 3455 | |||
| 3456 | ✗ | if(tempitem<0) break; | |
| 3457 | |||
| 3458 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3459 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3460 | { | ||
| 3461 | ✗ | tempitemx=x; | |
| 3462 | ✗ | tempitemy=y; | |
| 3463 | ✗ | } | |
| 3464 | |||
| 3465 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 4); | |
| 3466 | } | ||
| 3467 | |||
| 3468 | ✗ | break; | |
| 3469 | |||
| 3470 | case mfHOOKSHOT: | ||
| 3471 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!hints) |
| 3472 | { | ||
| 3473 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sHOOKSHOT],tmpscr->secretcset[sHOOKSHOT]); | |
| 3474 | ✗ | } | |
| 3475 | else | ||
| 3476 | { | ||
| 3477 | 17 | tempitem=getItemID(itemsbuf,itype_hookshot,1); | |
| 3478 | |||
| 3479 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(tempitem<0) break; |
| 3480 | |||
| 3481 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3482 |
3/6✓ Branch 0 taken 12 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3483 | { | ||
| 3484 | 12 | tempitemx=x; | |
| 3485 | 12 | tempitemy=y; | |
| 3486 | 12 | } | |
| 3487 | |||
| 3488 | 17 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3489 | } | ||
| 3490 | |||
| 3491 | 17 | break; | |
| 3492 | |||
| 3493 | case mfWAND: | ||
| 3494 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(!hints) |
| 3495 | { | ||
| 3496 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sWAND],tmpscr->secretcset[sWAND]); | |
| 3497 | ✗ | } | |
| 3498 | else | ||
| 3499 | { | ||
| 3500 | 35 | tempitem=getItemID(itemsbuf,itype_wand,1); | |
| 3501 | |||
| 3502 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(tempitem<0) break; |
| 3503 | |||
| 3504 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3505 |
3/6✓ Branch 0 taken 28 times.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
35 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3506 | { | ||
| 3507 | 28 | tempitemx=x; | |
| 3508 | 28 | tempitemy=y; | |
| 3509 | 28 | } | |
| 3510 | |||
| 3511 | 35 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3512 | } | ||
| 3513 | |||
| 3514 | 35 | break; | |
| 3515 | |||
| 3516 | case mfHAMMER: | ||
| 3517 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!hints) |
| 3518 | { | ||
| 3519 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2))putcombo(dest,x,y,tmpscr->secretcombo[sHAMMER],tmpscr->secretcset[sHAMMER]); | |
| 3520 | ✗ | } | |
| 3521 | else | ||
| 3522 | { | ||
| 3523 | 17 | tempitem=getItemID(itemsbuf,itype_hammer,1); | |
| 3524 | |||
| 3525 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(tempitem<0) break; |
| 3526 | |||
| 3527 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3528 |
3/6✓ Branch 0 taken 13 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3529 | { | ||
| 3530 | 13 | tempitemx=x; | |
| 3531 | 13 | tempitemy=y; | |
| 3532 | 13 | } | |
| 3533 | |||
| 3534 | 17 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3535 | } | ||
| 3536 | |||
| 3537 | 17 | break; | |
| 3538 | |||
| 3539 | case mfARMOS_ITEM: | ||
| 3540 | case mfDIVE_ITEM: | ||
| 3541 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 2064 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2064 times.
|
2064 | if((!getmapflag() || (tmpscr->flags9&fBELOWRETURN)) && !(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG3)) |
| 3542 | { | ||
| 3543 | 2064 | putitem2(dest,x,y,tmpscr->catchall, lens_hint_item[tmpscr->catchall][0], lens_hint_item[tmpscr->catchall][1], 0); | |
| 3544 | 2064 | } | |
| 3545 | 2064 | break; | |
| 3546 | |||
| 3547 | case 16: | ||
| 3548 | case 17: | ||
| 3549 | case 18: | ||
| 3550 | case 19: | ||
| 3551 | case 20: | ||
| 3552 | case 21: | ||
| 3553 | case 22: | ||
| 3554 | case 23: | ||
| 3555 | case 24: | ||
| 3556 | case 25: | ||
| 3557 | case 26: | ||
| 3558 | case 27: | ||
| 3559 | case 28: | ||
| 3560 | case 29: | ||
| 3561 | case 30: | ||
| 3562 | case 31: | ||
| 3563 |
2/2✓ Branch 0 taken 1008 times.
✓ Branch 1 taken 2610 times.
|
3618 | if(!hints) |
| 3564 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2610 times.
|
5220 | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2)) |
| 3565 | 2610 | putcombo(dest,x,y,tmpscr->secretcombo[checkflag-16+4],tmpscr->secretcset[checkflag-16+4]); | |
| 3566 | |||
| 3567 | 3618 | break; | |
| 3568 | case mfSECRETSNEXT: | ||
| 3569 | ✗ | if(!hints) | |
| 3570 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2)) | |
| 3571 | ✗ | putcombo(dest,x,y,tmpscr->data[i]+1,tmpscr->cset[i]); | |
| 3572 | |||
| 3573 | ✗ | break; | |
| 3574 | |||
| 3575 | case mfSTRIKE: | ||
| 3576 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 906 times.
|
906 | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2)) |
| 3577 | { | ||
| 3578 | 906 | goto special; | |
| 3579 | } | ||
| 3580 | else | ||
| 3581 | { | ||
| 3582 | ✗ | break; | |
| 3583 | } | ||
| 3584 | |||
| 3585 | 28640 | default: goto special; | |
| 3586 | |||
| 3587 | special: | ||
| 3588 |
8/8✓ Branch 0 taken 14677 times.
✓ Branch 1 taken 14869 times.
✓ Branch 2 taken 473 times.
✓ Branch 3 taken 14204 times.
✓ Branch 4 taken 441 times.
✓ Branch 5 taken 32 times.
✓ Branch 6 taken 6108 times.
✓ Branch 7 taken 8128 times.
|
29546 | if(layer && ((checkflag!=mfRAFT && checkflag!=mfRAFT_BRANCH&& checkflag!=mfRAFT_BOUNCE) ||(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG4))) |
| 3589 | { | ||
| 3590 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 6549 times.
✓ Branch 2 taken 4913 times.
✓ Branch 3 taken 1636 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1636 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
6549 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3591 | { | ||
| 3592 | 4913 | rectfill(dest,x,y,x+15,y+15,WHITE); | |
| 3593 | 4913 | } | |
| 3594 | 6549 | } | |
| 3595 | |||
| 3596 | 29546 | break; | |
| 3597 | } | ||
| 3598 | 5748864 | } | |
| 3599 | 2874432 | } | |
| 3600 | |||
| 3601 |
2/2✓ Branch 0 taken 8166 times.
✓ Branch 1 taken 8166 times.
|
16332 | if(layer) |
| 3602 | { | ||
| 3603 |
2/2✓ Branch 0 taken 7978 times.
✓ Branch 1 taken 188 times.
|
8166 | if(tmpscr->door[0]==dWALK) |
| 3604 | 188 | rectfill(dest, 120, 16+playing_field_offset, 135, 31+playing_field_offset, WHITE); | |
| 3605 | |||
| 3606 |
2/2✓ Branch 0 taken 7969 times.
✓ Branch 1 taken 197 times.
|
8166 | if(tmpscr->door[1]==dWALK) |
| 3607 | 197 | rectfill(dest, 120, 144+playing_field_offset, 135, 159+playing_field_offset, WHITE); | |
| 3608 | |||
| 3609 |
2/2✓ Branch 0 taken 8014 times.
✓ Branch 1 taken 152 times.
|
8166 | if(tmpscr->door[2]==dWALK) |
| 3610 | 152 | rectfill(dest, 16, 80+playing_field_offset, 31, 95+playing_field_offset, WHITE); | |
| 3611 | |||
| 3612 |
2/2✓ Branch 0 taken 7940 times.
✓ Branch 1 taken 226 times.
|
8166 | if(tmpscr->door[3]==dWALK) |
| 3613 | 226 | rectfill(dest, 224, 80+playing_field_offset, 239, 95+playing_field_offset, WHITE); | |
| 3614 | |||
| 3615 |
2/2✓ Branch 0 taken 8123 times.
✓ Branch 1 taken 43 times.
|
8166 | if(tmpscr->door[0]==dBOMB) |
| 3616 | { | ||
| 3617 | 43 | showbombeddoor(dest, 0); | |
| 3618 | 43 | } | |
| 3619 | |||
| 3620 |
2/2✓ Branch 0 taken 8127 times.
✓ Branch 1 taken 39 times.
|
8166 | if(tmpscr->door[1]==dBOMB) |
| 3621 | { | ||
| 3622 | 39 | showbombeddoor(dest, 1); | |
| 3623 | 39 | } | |
| 3624 | |||
| 3625 |
1/2✓ Branch 0 taken 8166 times.
✗ Branch 1 not taken.
|
8166 | if(tmpscr->door[2]==dBOMB) |
| 3626 | { | ||
| 3627 | ✗ | showbombeddoor(dest, 2); | |
| 3628 | ✗ | } | |
| 3629 | |||
| 3630 |
2/2✓ Branch 0 taken 8129 times.
✓ Branch 1 taken 37 times.
|
8166 | if(tmpscr->door[3]==dBOMB) |
| 3631 | { | ||
| 3632 | 37 | showbombeddoor(dest, 3); | |
| 3633 | 37 | } | |
| 3634 | 8166 | } | |
| 3635 | |||
| 3636 |
2/2✓ Branch 0 taken 14298 times.
✓ Branch 1 taken 2034 times.
|
16332 | if(tmpscr->stairx + tmpscr->stairy) |
| 3637 | { | ||
| 3638 |
2/2✓ Branch 0 taken 911 times.
✓ Branch 1 taken 1123 times.
|
2034 | if(!hints) |
| 3639 | { | ||
| 3640 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1123 times.
|
1123 | if(!(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG2)) |
| 3641 | 1123 | putcombo(dest,tmpscr->stairx,tmpscr->stairy+playing_field_offset,tmpscr->secretcombo[sSTAIRS],tmpscr->secretcset[sSTAIRS]); | |
| 3642 | 1123 | } | |
| 3643 | else | ||
| 3644 | { | ||
| 3645 |
2/2✓ Branch 0 taken 863 times.
✓ Branch 1 taken 48 times.
|
911 | if(tmpscr->flags&fWHISTLE) |
| 3646 | { | ||
| 3647 | 48 | tempitem=getItemID(itemsbuf,itype_whistle,1); | |
| 3648 | 48 | int32_t tempitemx=-16; | |
| 3649 | 48 | int32_t tempitemy=-16; | |
| 3650 | |||
| 3651 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&(blink_rate/4))) |
| 3652 |
3/6✓ Branch 0 taken 24 times.
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
48 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&(blink_rate/4)))) |
| 3653 | { | ||
| 3654 | 24 | tempitemx=tmpscr->stairx; | |
| 3655 | 24 | tempitemy=tmpscr->stairy+playing_field_offset; | |
| 3656 | 24 | } | |
| 3657 | |||
| 3658 | 48 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3659 | 48 | } | |
| 3660 | } | ||
| 3661 | 2034 | } | |
| 3662 | } | ||
| 3663 | 16332 | } | |
| 3664 | |||
| 3665 | BITMAP *lens_scr_d; // The "d" is for "destructible"! | ||
| 3666 | |||
| 3667 | 7997 | void draw_lens_over() | |
| 3668 | { | ||
| 3669 | // Oh, what the heck. | ||
| 3670 | static BITMAP *lens_scr = NULL; | ||
| 3671 | static int32_t last_width = -1; | ||
| 3672 | 7997 | int32_t width = itemsbuf[current_item_id(itype_lens,true)].misc1; | |
| 3673 | |||
| 3674 | // Only redraw the circle if the size has changed | ||
| 3675 |
2/2✓ Branch 0 taken 7992 times.
✓ Branch 1 taken 5 times.
|
7997 | if(width != last_width) |
| 3676 | { | ||
| 3677 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(lens_scr == NULL) |
| 3678 | { | ||
| 3679 | 5 | lens_scr = create_bitmap_ex(8,2*288,2*(240-playing_field_offset)); | |
| 3680 | 5 | } | |
| 3681 | |||
| 3682 | 5 | clear_to_color(lens_scr, BLACK); | |
| 3683 | 5 | circlefill(lens_scr, 288, 240-playing_field_offset, width, 0); | |
| 3684 | 5 | circle(lens_scr, 288, 240-playing_field_offset, width+2, 0); | |
| 3685 | 5 | circle(lens_scr, 288, 240-playing_field_offset, width+5, 0); | |
| 3686 | 5 | last_width=width; | |
| 3687 | 5 | } | |
| 3688 | |||
| 3689 | 7997 | masked_blit(lens_scr, framebuf, 288-(HeroX()+8), 240-playing_field_offset-(HeroY()+8), 0, playing_field_offset, 256, 168); | |
| 3690 | 7997 | } | |
| 3691 | |||
| 3692 | //---------------------------------------------------------------- | ||
| 3693 | |||
| 3694 | 31111 | void draw_wavy(BITMAP *source, BITMAP *target, int32_t amplitude, bool interpol) | |
| 3695 | { | ||
| 3696 | //recreating a big bitmap every frame is highly sluggish. | ||
| 3697 |
4/6✓ Branch 0 taken 3 times.
✓ Branch 1 taken 31108 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
31111 | static BITMAP *wavebuf = create_bitmap_ex(8,288,240-original_playing_field_offset); |
| 3698 | 31111 | clear_to_color(wavebuf, BLACK); | |
| 3699 | 31111 | blit(source,wavebuf,0,original_playing_field_offset,16,0,256,224-original_playing_field_offset); | |
| 3700 | |||
| 3701 | int32_t ofs; | ||
| 3702 | // int32_t amplitude=8; | ||
| 3703 | // int32_t wavelength=4; | ||
| 3704 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31111 times.
|
31111 | amplitude = zc_min(2048,amplitude); // some arbitrary limit to prevent crashing |
| 3705 |
3/6✓ Branch 0 taken 31111 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 31111 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 31111 times.
|
31111 | if(flash_reduction_enabled() && !get_qr(qr_WAVY_NO_EPILEPSY)) amplitude = zc_min(16,amplitude); |
| 3706 | 31111 | int32_t amp2=168; | |
| 3707 |
2/4✓ Branch 0 taken 31111 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 31111 times.
|
31111 | if(flash_reduction_enabled() && !get_qr(qr_WAVY_NO_EPILEPSY_2)) amp2*=2; |
| 3708 | 31111 | int32_t i=frame%amp2; | |
| 3709 | |||
| 3710 |
2/2✓ Branch 0 taken 5226648 times.
✓ Branch 1 taken 31111 times.
|
5257759 | for(int32_t j=0; j<168; j++) |
| 3711 | { | ||
| 3712 |
3/4✓ Branch 0 taken 2613324 times.
✓ Branch 1 taken 2613324 times.
✓ Branch 2 taken 2613324 times.
✗ Branch 3 not taken.
|
5226648 | if(j&1 && interpol) |
| 3713 | { | ||
| 3714 | // Add 288*2048 to ensure it's never negative. It'll get modded out. | ||
| 3715 | ✗ | ofs=288*2048+int32_t(zc::math::Sin((double(i+j)*2*PI/amp2))*amplitude); | |
| 3716 | ✗ | } | |
| 3717 | else | ||
| 3718 | { | ||
| 3719 | 5226648 | ofs=288*2048-int32_t(zc::math::Sin((double(i+j)*2*PI/amp2))*amplitude); | |
| 3720 | } | ||
| 3721 | |||
| 3722 |
1/2✓ Branch 0 taken 5226648 times.
✗ Branch 1 not taken.
|
5226648 | if(ofs) |
| 3723 | { | ||
| 3724 |
2/2✓ Branch 0 taken 1338021888 times.
✓ Branch 1 taken 5226648 times.
|
1343248536 | for(int32_t k=0; k<256; k++) |
| 3725 | { | ||
| 3726 | 1338021888 | target->line[j+original_playing_field_offset][k]=wavebuf->line[j][(k+ofs+16)%288]; | |
| 3727 | 1338021888 | } | |
| 3728 | 5226648 | } | |
| 3729 | 5226648 | } | |
| 3730 | 31111 | } | |
| 3731 | |||
| 3732 | 4848 | void draw_fuzzy(int32_t fuzz) | |
| 3733 | // draws from right half of scrollbuf to framebuf | ||
| 3734 | { | ||
| 3735 | int32_t firstx, firsty, xstep, ystep, i, y, dx, dy; | ||
| 3736 | byte *start, *si, *di; | ||
| 3737 | |||
| 3738 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4848 times.
|
4848 | if(fuzz<1) |
| 3739 | ✗ | fuzz = 1; | |
| 3740 | |||
| 3741 | 4848 | xstep = 128%fuzz; | |
| 3742 | |||
| 3743 |
2/2✓ Branch 0 taken 1010 times.
✓ Branch 1 taken 3838 times.
|
4848 | if(xstep > 0) |
| 3744 | 3838 | xstep = fuzz-xstep; | |
| 3745 | |||
| 3746 | 4848 | ystep = 112%fuzz; | |
| 3747 | |||
| 3748 |
2/2✓ Branch 0 taken 1414 times.
✓ Branch 1 taken 3434 times.
|
4848 | if(ystep > 0) |
| 3749 | 3434 | ystep = fuzz-ystep; | |
| 3750 | |||
| 3751 | 4848 | firsty = 1; | |
| 3752 | |||
| 3753 |
2/2✓ Branch 0 taken 4848 times.
✓ Branch 1 taken 174932 times.
|
179780 | for(y=0; y<224;) |
| 3754 | { | ||
| 3755 | 174932 | start = &(scrollbuf->line[y][256]); | |
| 3756 | |||
| 3757 |
4/4✓ Branch 0 taken 172508 times.
✓ Branch 1 taken 1088376 times.
✓ Branch 2 taken 1085952 times.
✓ Branch 3 taken 174932 times.
|
1260884 | for(dy=0; dy<ystep && dy+y<224; dy++) |
| 3758 | { | ||
| 3759 | 1085952 | si = start; | |
| 3760 | 1085952 | di = &(framebuf->line[y+dy][0]); | |
| 3761 | 1085952 | i = xstep; | |
| 3762 | 1085952 | firstx = 1; | |
| 3763 | |||
| 3764 |
2/2✓ Branch 0 taken 278003712 times.
✓ Branch 1 taken 1085952 times.
|
279089664 | for(dx=0; dx<256; dx++) |
| 3765 | { | ||
| 3766 | 278003712 | *(di++) = *si; | |
| 3767 | |||
| 3768 |
2/2✓ Branch 0 taken 234248896 times.
✓ Branch 1 taken 43754816 times.
|
278003712 | if(++i >= fuzz) |
| 3769 | { | ||
| 3770 |
2/2✓ Branch 0 taken 42668864 times.
✓ Branch 1 taken 1085952 times.
|
43754816 | if(!firstx) |
| 3771 | 42668864 | si += fuzz; | |
| 3772 | else | ||
| 3773 | { | ||
| 3774 | 1085952 | si += fuzz-xstep; | |
| 3775 | 1085952 | firstx = 0; | |
| 3776 | } | ||
| 3777 | |||
| 3778 | 43754816 | i = 0; | |
| 3779 | 43754816 | } | |
| 3780 | 278003712 | } | |
| 3781 | 1085952 | } | |
| 3782 | |||
| 3783 |
2/2✓ Branch 0 taken 170084 times.
✓ Branch 1 taken 4848 times.
|
174932 | if(!firsty) |
| 3784 | 170084 | y += fuzz; | |
| 3785 | else | ||
| 3786 | { | ||
| 3787 | 4848 | y += ystep; | |
| 3788 | 4848 | ystep = fuzz; | |
| 3789 | 4848 | firsty = 0; | |
| 3790 | } | ||
| 3791 | } | ||
| 3792 | 4848 | } | |
| 3793 | |||
| 3794 | 9285079 | void updatescr(bool allowwavy) | |
| 3795 | { | ||
| 3796 |
4/6✓ Branch 0 taken 46 times.
✓ Branch 1 taken 9285033 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 46 times.
✓ Branch 4 taken 46 times.
✗ Branch 5 not taken.
|
9285079 | static BITMAP *wavybuf = create_bitmap_ex(8,256,224); |
| 3797 |
4/6✓ Branch 0 taken 46 times.
✓ Branch 1 taken 9285033 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 46 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 46 times.
|
9285079 | static BITMAP *panorama = create_bitmap_ex(8,256,224); |
| 3798 | |||
| 3799 |
2/2✓ Branch 0 taken 9258314 times.
✓ Branch 1 taken 26765 times.
|
9285079 | if(toogam) |
| 3800 | { | ||
| 3801 | 26765 | textout_ex(framebuf,font,"no walls",8,216,1,-1); | |
| 3802 | 26765 | } | |
| 3803 | |||
| 3804 |
1/2✓ Branch 0 taken 9285079 times.
✗ Branch 1 not taken.
|
9285079 | if(Showpal) |
| 3805 | ✗ | dump_pal(framebuf); | |
| 3806 | |||
| 3807 |
2/2✓ Branch 0 taken 8984016 times.
✓ Branch 1 taken 301063 times.
|
9285079 | if(!Playing) |
| 3808 | 301063 | black_opening_count=0; | |
| 3809 | |||
| 3810 |
2/2✓ Branch 0 taken 9211819 times.
✓ Branch 1 taken 73260 times.
|
9285079 | if(black_opening_count<0) //shape is opening up |
| 3811 | { | ||
| 3812 | 73260 | black_opening(framebuf,black_opening_x,black_opening_y,(66+black_opening_count),66); | |
| 3813 | |||
| 3814 |
2/4✓ Branch 0 taken 73260 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 73260 times.
|
73260 | if(Advance||(!Paused)) |
| 3815 | { | ||
| 3816 | 73260 | ++black_opening_count; | |
| 3817 | 73260 | } | |
| 3818 | 73260 | } | |
| 3819 |
2/2✓ Branch 0 taken 9185683 times.
✓ Branch 1 taken 26136 times.
|
9211819 | else if(black_opening_count>0) //shape is closing |
| 3820 | { | ||
| 3821 | 26136 | black_opening(framebuf,black_opening_x,black_opening_y,black_opening_count,66); | |
| 3822 | |||
| 3823 |
2/4✓ Branch 0 taken 26136 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 26136 times.
|
26136 | if(Advance||(!Paused)) |
| 3824 | { | ||
| 3825 | 26136 | --black_opening_count; | |
| 3826 | 26136 | } | |
| 3827 | 26136 | } | |
| 3828 | |||
| 3829 |
3/4✓ Branch 0 taken 9187189 times.
✓ Branch 1 taken 97890 times.
✓ Branch 2 taken 9187189 times.
✗ Branch 3 not taken.
|
9285079 | if(black_opening_count==0&&black_opening_shape==bosFADEBLACK) |
| 3830 | { | ||
| 3831 | ✗ | black_opening_shape = bosCIRCLE; | |
| 3832 | ✗ | memcpy(RAMpal, tempblackpal, PAL_SIZE*sizeof(RGB)); | |
| 3833 | ✗ | refreshTints(); | |
| 3834 | ✗ | refreshpal=true; | |
| 3835 | ✗ | } | |
| 3836 | |||
| 3837 |
2/2✓ Branch 0 taken 9030880 times.
✓ Branch 1 taken 254199 times.
|
9285079 | if(refreshpal) |
| 3838 | { | ||
| 3839 | 254199 | refreshpal=false; | |
| 3840 | 254199 | RAMpal[253] = _RGB(0,0,0); | |
| 3841 | 254199 | RAMpal[254] = _RGB(63,63,63); | |
| 3842 | 254199 | hw_palette = &RAMpal; | |
| 3843 | 254199 | update_hw_pal = true; | |
| 3844 | |||
| 3845 | 254199 | create_rgb_table(&rgb_table, RAMpal, NULL); | |
| 3846 | 254199 | create_zc_trans_table(&trans_table, RAMpal, 128, 128, 128); | |
| 3847 | 254199 | memcpy(&trans_table2, &trans_table, sizeof(COLOR_MAP)); | |
| 3848 | |||
| 3849 |
2/2✓ Branch 0 taken 65074944 times.
✓ Branch 1 taken 254199 times.
|
65329143 | for(int32_t q=0; q<PAL_SIZE; q++) |
| 3850 | { | ||
| 3851 | 65074944 | trans_table2.data[0][q] = q; | |
| 3852 | 65074944 | trans_table2.data[q][q] = q; | |
| 3853 | 65074944 | } | |
| 3854 | 254199 | } | |
| 3855 | |||
| 3856 | 9285079 | bool clearwavy = (wavy <= 0); | |
| 3857 | |||
| 3858 |
2/2✓ Branch 0 taken 7655 times.
✓ Branch 1 taken 9277424 times.
|
9285079 | if(wavy <= 0) |
| 3859 | { | ||
| 3860 | // So far one thing can alter wavy apart from scripts: Wavy DMaps. | ||
| 3861 | 9277424 | wavy = (DMaps[currdmap].flags&dmfWAVY ? 4 : 0); | |
| 3862 | 9277424 | } | |
| 3863 | |||
| 3864 | 9285079 | blit(framebuf, wavybuf, 0, 0, 0, 0, 256, 224); | |
| 3865 | |||
| 3866 |
6/6✓ Branch 0 taken 31361 times.
✓ Branch 1 taken 9253718 times.
✓ Branch 2 taken 31239 times.
✓ Branch 3 taken 122 times.
✓ Branch 4 taken 128 times.
✓ Branch 5 taken 31111 times.
|
9285079 | if(wavy && Playing && allowwavy) |
| 3867 | { | ||
| 3868 | 31111 | draw_wavy(framebuf, wavybuf, wavy,false); | |
| 3869 | 31111 | } | |
| 3870 | |||
| 3871 |
2/2✓ Branch 0 taken 9277424 times.
✓ Branch 1 taken 7655 times.
|
9285079 | if(clearwavy) |
| 3872 | 9277424 | wavy = 0; // Wavy was set by a DMap flag. Clear it. | |
| 3873 |
2/4✓ Branch 0 taken 7655 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7655 times.
|
7655 | else if(Playing && !Paused) |
| 3874 | 7655 | wavy--; // Wavy was set by a script. Decrement it. | |
| 3875 | |||
| 3876 |
5/6✓ Branch 0 taken 8984016 times.
✓ Branch 1 taken 301063 times.
✓ Branch 2 taken 259574 times.
✓ Branch 3 taken 8724442 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 259574 times.
|
9285079 | if(Playing && msgpos && !screenscrolling) |
| 3877 | { | ||
| 3878 |
1/2✓ Branch 0 taken 259574 times.
✗ Branch 1 not taken.
|
259574 | if(!(msg_bg_display_buf->clip)) |
| 3879 | 259574 | blit_msgstr_bg(framebuf,0,0,0,playing_field_offset,256,168); | |
| 3880 |
1/2✓ Branch 0 taken 259574 times.
✗ Branch 1 not taken.
|
259574 | if(!(msg_portrait_display_buf->clip)) |
| 3881 | 259574 | blit_msgstr_prt(framebuf,0,0,0,playing_field_offset,256,168); | |
| 3882 |
1/2✓ Branch 0 taken 259574 times.
✗ Branch 1 not taken.
|
259574 | if(!(msg_txt_display_buf->clip)) |
| 3883 | 259574 | blit_msgstr_fg(framebuf,0,0,0,playing_field_offset,256,168); | |
| 3884 | 259574 | } | |
| 3885 | |||
| 3886 | /* | ||
| 3887 | if(!(msg_txt_display_buf->clip) && Playing && msgpos && !screenscrolling) | ||
| 3888 | { | ||
| 3889 | BITMAP* subBmp = 0; | ||
| 3890 | masked_blit(msg_txt_display_buf,subBmp,0,0,0,playing_field_offset,256,168); | ||
| 3891 | // masked_blit(msg_txt_display_buf,subBmp,0,playing_field_offset,256,168); | ||
| 3892 | draw_trans_sprite(framebuf, subBmp, 0, playing_field_offset); | ||
| 3893 | destroy_bitmap(subBmp); | ||
| 3894 | //void draw_sprite_ex(BITMAP *bmp, BITMAP *sprite, int32_t x, int32_t y, int32_t mode, int32_t flip); | ||
| 3895 | // masked_blit(msg_txt_display_buf,framebuf,0,0,0,playing_field_offset,256,168); | ||
| 3896 | //void masked_blit(BITMAP *source, BITMAP *dest, int32_t source_x, int32_t source_y, int32_t dest_x, int32_t dest_y, int32_t width, int32_t height); | ||
| 3897 | } | ||
| 3898 | */ | ||
| 3899 | |||
| 3900 |
2/2✓ Branch 0 taken 9244022 times.
✓ Branch 1 taken 41057 times.
|
9285079 | bool nosubscr = (tmpscr->flags3&fNOSUBSCR && !(tmpscr->flags3&fNOSUBSCROFFSET)); |
| 3901 | |||
| 3902 |
2/2✓ Branch 0 taken 9248647 times.
✓ Branch 1 taken 36432 times.
|
9285079 | if(nosubscr) |
| 3903 | { | ||
| 3904 | 36432 | rectfill(panorama,0,0,255,passive_subscreen_height/2,0); | |
| 3905 | 36432 | rectfill(panorama,0,168+passive_subscreen_height/2,255,168+passive_subscreen_height-1,0); | |
| 3906 | 36432 | blit(wavybuf,panorama,0,playing_field_offset,0,passive_subscreen_height/2,256,224-passive_subscreen_height); | |
| 3907 | 36432 | } | |
| 3908 | |||
| 3909 | //TODO: Optimize blit 'overcalls' -Gleeok | ||
| 3910 |
2/2✓ Branch 0 taken 36432 times.
✓ Branch 1 taken 9248647 times.
|
9285079 | BITMAP *source = nosubscr ? panorama : wavybuf; |
| 3911 | 9285079 | blit(source,framebuf,0,0,0,0,256,224); | |
| 3912 | |||
| 3913 | 9285079 | update_hw_screen(); | |
| 3914 | 9285079 | } | |
| 3915 | |||
| 3916 | //---------------------------------------------------------------- | ||
| 3917 | |||
| 3918 | static PALETTE syspal; | ||
| 3919 | ✗ | int32_t onGUISnapshot() | |
| 3920 | { | ||
| 3921 | char buf[200]; | ||
| 3922 | ✗ | int32_t num=0; | |
| 3923 | ✗ | bool realpal=(key[KEY_ZC_LCONTROL] || key[KEY_ZC_RCONTROL]); | |
| 3924 | ✗ | do | |
| 3925 | { | ||
| 3926 | ✗ | sprintf(buf, "%szc_screen%05d.%s", get_snap_str(), ++num, snapshotformat_str[SnapshotFormat][1]); | |
| 3927 | ✗ | } | |
| 3928 | ✗ | while(num<99999 && exists(buf)); | |
| 3929 | |||
| 3930 | ✗ | BITMAP *b = create_bitmap_ex(8,resx,resy); | |
| 3931 | |||
| 3932 | ✗ | if(b) | |
| 3933 | { | ||
| 3934 | ✗ | blit(screen,b,0,0,0,0,resx,resy); | |
| 3935 | ✗ | save_bitmap(buf,b,RAMpal); | |
| 3936 | ✗ | destroy_bitmap(b); | |
| 3937 | ✗ | } | |
| 3938 | |||
| 3939 | ✗ | return D_O_K; | |
| 3940 | } | ||
| 3941 | |||
| 3942 | ✗ | int32_t onNonGUISnapshot() | |
| 3943 | { | ||
| 3944 | PALETTE temppal; | ||
| 3945 | ✗ | get_palette(temppal); | |
| 3946 | ✗ | bool realpal=(zc_getkey(KEY_ZC_LCONTROL, true) || zc_getkey(KEY_ZC_RCONTROL, true)); | |
| 3947 | |||
| 3948 | char buf[200]; | ||
| 3949 | ✗ | int32_t num=0; | |
| 3950 | |||
| 3951 | ✗ | do | |
| 3952 | { | ||
| 3953 | ✗ | sprintf(buf, "%szc_screen%05d.%s", get_snap_str(), ++num, snapshotformat_str[SnapshotFormat][1]); | |
| 3954 | ✗ | } | |
| 3955 | ✗ | while(num<99999 && exists(buf)); | |
| 3956 | |||
| 3957 | ✗ | save_bitmap(buf,framebuf,realpal?temppal:RAMpal); | |
| 3958 | |||
| 3959 | ✗ | return D_O_K; | |
| 3960 | } | ||
| 3961 | |||
| 3962 | ✗ | int32_t onSnapshot() | |
| 3963 | { | ||
| 3964 | ✗ | if(zc_getkey(KEY_LSHIFT, true)||zc_getkey(KEY_RSHIFT, true)) | |
| 3965 | { | ||
| 3966 | ✗ | onGUISnapshot(); | |
| 3967 | ✗ | } | |
| 3968 | else | ||
| 3969 | { | ||
| 3970 | ✗ | onNonGUISnapshot(); | |
| 3971 | } | ||
| 3972 | |||
| 3973 | ✗ | return D_O_K; | |
| 3974 | } | ||
| 3975 | |||
| 3976 | ✗ | int32_t onSaveMapPic() | |
| 3977 | { | ||
| 3978 | ✗ | int32_t mapres2 = 0; | |
| 3979 | char buf[200]; | ||
| 3980 | ✗ | int32_t num=0; | |
| 3981 | ✗ | mapscr tmpscr_b[2]; | |
| 3982 | ✗ | mapscr tmpscr_c[6]; | |
| 3983 | ✗ | BITMAP* _screen_draw_buffer = NULL; | |
| 3984 | ✗ | _screen_draw_buffer = create_bitmap_ex(8,256,224); | |
| 3985 | ✗ | set_clip_state(_screen_draw_buffer,1); | |
| 3986 | |||
| 3987 | ✗ | for(int32_t i=0; i<6; ++i) | |
| 3988 | { | ||
| 3989 | ✗ | tmpscr_c[i] = tmpscr2[i]; | |
| 3990 | ✗ | tmpscr2[i].zero_memory(); | |
| 3991 | |||
| 3992 | ✗ | if(i>=2) | |
| 3993 | { | ||
| 3994 | ✗ | continue; | |
| 3995 | } | ||
| 3996 | |||
| 3997 | ✗ | tmpscr_b[i] = tmpscr[i]; | |
| 3998 | ✗ | tmpscr[i].zero_memory(); | |
| 3999 | ✗ | } | |
| 4000 | |||
| 4001 | ✗ | do | |
| 4002 | { | ||
| 4003 | ✗ | sprintf(buf, "%szc_screen%05d.png", get_snap_str(), ++num); | |
| 4004 | ✗ | } | |
| 4005 | ✗ | while(num<99999 && exists(buf)); | |
| 4006 | |||
| 4007 | ✗ | BITMAP* mappic = NULL; | |
| 4008 | |||
| 4009 | |||
| 4010 | ✗ | bool done=false, redraw=true; | |
| 4011 | |||
| 4012 | ✗ | mappic = create_bitmap_ex(8,(256*16)>>mapres,(176*8)>>mapres); | |
| 4013 | |||
| 4014 | ✗ | if(!mappic) | |
| 4015 | { | ||
| 4016 | ✗ | enter_sys_pal(); | |
| 4017 | ✗ | jwin_alert("View Map","Not enough memory.",NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 4018 | ✗ | exit_sys_pal(); | |
| 4019 | ✗ | return D_O_K;; | |
| 4020 | } | ||
| 4021 | |||
| 4022 | // draw the map | ||
| 4023 | ✗ | set_clip_rect(_screen_draw_buffer, 0, 0, _screen_draw_buffer->w, _screen_draw_buffer->h); | |
| 4024 | |||
| 4025 | ✗ | for(int32_t y=0; y<8; y++) | |
| 4026 | { | ||
| 4027 | ✗ | for(int32_t x=0; x<16; x++) | |
| 4028 | { | ||
| 4029 | ✗ | if(!displayOnMap(x, y)) | |
| 4030 | { | ||
| 4031 | ✗ | rectfill(_screen_draw_buffer, 0, 0, 255, 223, WHITE); | |
| 4032 | ✗ | } | |
| 4033 | else | ||
| 4034 | { | ||
| 4035 | ✗ | int32_t s = (y<<4) + x; | |
| 4036 | ✗ | loadscr2(1,s,-1); | |
| 4037 | |||
| 4038 | ✗ | for(int32_t i=0; i<6; i++) | |
| 4039 | { | ||
| 4040 | ✗ | if(tmpscr[1].layermap[i]<=0) | |
| 4041 | ✗ | continue; | |
| 4042 | |||
| 4043 | ✗ | if((ZCMaps[tmpscr[1].layermap[i]-1].tileWidth==ZCMaps[currmap].tileWidth) && | |
| 4044 | ✗ | (ZCMaps[tmpscr[1].layermap[i]-1].tileHeight==ZCMaps[currmap].tileHeight)) | |
| 4045 | { | ||
| 4046 | ✗ | const int32_t _mapsSize = (ZCMaps[currmap].tileWidth)*(ZCMaps[currmap].tileHeight); | |
| 4047 | |||
| 4048 | ✗ | tmpscr2[i]=TheMaps[(tmpscr[1].layermap[i]-1)*MAPSCRS+tmpscr[1].layerscreen[i]]; | |
| 4049 | ✗ | } | |
| 4050 | ✗ | } | |
| 4051 | |||
| 4052 | ✗ | if(XOR((tmpscr+1)->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(_screen_draw_buffer, 0, 2, tmpscr+1, -256, playing_field_offset, 2); | |
| 4053 | |||
| 4054 | ✗ | if(XOR((tmpscr+1)->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(_screen_draw_buffer, 0, 3, tmpscr+1, -256, playing_field_offset, 2); | |
| 4055 | |||
| 4056 | ✗ | putscr(_screen_draw_buffer,256,0,tmpscr+1); | |
| 4057 | ✗ | do_layer(_screen_draw_buffer, 0, 1, tmpscr+1, -256, playing_field_offset, 2); | |
| 4058 | |||
| 4059 | ✗ | if(!XOR((tmpscr+1)->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(_screen_draw_buffer, 0, 2, tmpscr+1, -256, playing_field_offset, 2); | |
| 4060 | |||
| 4061 | ✗ | putscrdoors(_screen_draw_buffer,256,0,tmpscr+1); | |
| 4062 | ✗ | do_layer(_screen_draw_buffer, -2, 0, tmpscr+1, -256, playing_field_offset, 2); | |
| 4063 | ✗ | if(get_qr(qr_PUSHBLOCK_LAYER_1_2)) | |
| 4064 | { | ||
| 4065 | ✗ | do_layer(_screen_draw_buffer, -2, 1, tmpscr+1, -256, playing_field_offset, 2); | |
| 4066 | ✗ | do_layer(_screen_draw_buffer, -2, 2, tmpscr+1, -256, playing_field_offset, 2); | |
| 4067 | ✗ | } | |
| 4068 | ✗ | do_layer(_screen_draw_buffer, -3, 0, tmpscr+1, -256, playing_field_offset, 2); // Freeform combos! | |
| 4069 | |||
| 4070 | ✗ | if(!XOR((tmpscr+1)->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(_screen_draw_buffer, 0, 3, tmpscr+1, -256, playing_field_offset, 2); | |
| 4071 | |||
| 4072 | ✗ | do_layer(_screen_draw_buffer, 0, 4, tmpscr+1, -256, playing_field_offset, 2); | |
| 4073 | ✗ | do_layer(_screen_draw_buffer, -1, 0, tmpscr+1, -256, playing_field_offset, 2); | |
| 4074 | ✗ | if(get_qr(qr_OVERHEAD_COMBOS_L1_L2)) | |
| 4075 | { | ||
| 4076 | ✗ | do_layer(_screen_draw_buffer, -1, 1, tmpscr+1, -256, playing_field_offset, 2); | |
| 4077 | ✗ | do_layer(_screen_draw_buffer, -1, 2, tmpscr+1, -256, playing_field_offset, 2); | |
| 4078 | ✗ | } | |
| 4079 | ✗ | do_layer(_screen_draw_buffer, 0, 5, tmpscr+1, -256, playing_field_offset, 2); | |
| 4080 | ✗ | do_layer(_screen_draw_buffer, 0, 6, tmpscr+1, -256, playing_field_offset, 2); | |
| 4081 | |||
| 4082 | } | ||
| 4083 | |||
| 4084 | ✗ | stretch_blit(_screen_draw_buffer, mappic, 256, 0, 256, 176, x<<(8-mapres), (y*176)>>mapres, 256>>mapres, 176>>mapres); | |
| 4085 | ✗ | } | |
| 4086 | ✗ | } | |
| 4087 | |||
| 4088 | ✗ | for(int32_t i=0; i<6; ++i) | |
| 4089 | { | ||
| 4090 | ✗ | tmpscr2[i]=tmpscr_c[i]; | |
| 4091 | |||
| 4092 | ✗ | if(i>=2) | |
| 4093 | { | ||
| 4094 | ✗ | continue; | |
| 4095 | } | ||
| 4096 | |||
| 4097 | ✗ | tmpscr[i]=tmpscr_b[i]; | |
| 4098 | ✗ | } | |
| 4099 | |||
| 4100 | ✗ | save_bitmap(buf,mappic,RAMpal); | |
| 4101 | ✗ | destroy_bitmap(mappic); | |
| 4102 | ✗ | destroy_bitmap(_screen_draw_buffer); | |
| 4103 | ✗ | return D_O_K; | |
| 4104 | ✗ | } | |
| 4105 | |||
| 4106 | 13 | void f_Quit(int32_t type) | |
| 4107 | { | ||
| 4108 |
2/4✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
|
13 | if(type==qQUIT && !Playing) |
| 4109 | ✗ | return; | |
| 4110 | |||
| 4111 | 13 | bool from_menu = is_sys_pal; | |
| 4112 | |||
| 4113 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if(!from_menu) |
| 4114 | { | ||
| 4115 | 13 | music_pause(); | |
| 4116 | 13 | pause_all_sfx(); | |
| 4117 | 13 | sys_mouse(); | |
| 4118 | 13 | } | |
| 4119 | 13 | enter_sys_pal(); | |
| 4120 | 13 | clear_keybuf(); | |
| 4121 | |||
| 4122 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if (replay_version_check(0, 10)) |
| 4123 | 13 | replay_poll(); | |
| 4124 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if (replay_is_replaying()) |
| 4125 | 13 | replay_peek_quit(); | |
| 4126 | |||
| 4127 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (!replay_is_replaying()) |
| 4128 | ✗ | switch(type) | |
| 4129 | { | ||
| 4130 | case qQUIT: | ||
| 4131 | ✗ | onQuit(); | |
| 4132 | ✗ | break; | |
| 4133 | |||
| 4134 | case qRESET: | ||
| 4135 | ✗ | onReset(); | |
| 4136 | ✗ | break; | |
| 4137 | |||
| 4138 | case qEXIT: | ||
| 4139 | ✗ | onExit(); | |
| 4140 | ✗ | break; | |
| 4141 | ✗ | } | |
| 4142 | |||
| 4143 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if(Quit) |
| 4144 | { | ||
| 4145 | 13 | kill_sfx(); | |
| 4146 | 13 | music_stop(); | |
| 4147 | 13 | exit_sys_pal(); | |
| 4148 | 13 | update_hw_screen(); | |
| 4149 | 13 | } | |
| 4150 | else | ||
| 4151 | { | ||
| 4152 | ✗ | exit_sys_pal(); | |
| 4153 | ✗ | if(!from_menu) | |
| 4154 | { | ||
| 4155 | ✗ | music_resume(); | |
| 4156 | ✗ | resume_all_sfx(); | |
| 4157 | ✗ | } | |
| 4158 | } | ||
| 4159 | |||
| 4160 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if(!from_menu) |
| 4161 | 13 | game_mouse(); | |
| 4162 | 13 | eat_buttons(); | |
| 4163 | |||
| 4164 | 13 | zc_readrawkey(KEY_ESC); | |
| 4165 | |||
| 4166 | 13 | zc_readrawkey(KEY_ENTER); | |
| 4167 | 13 | } | |
| 4168 | |||
| 4169 | //---------------------------------------------------------------- | ||
| 4170 | |||
| 4171 | ✗ | int32_t onNoWalls() | |
| 4172 | { | ||
| 4173 | ✗ | cheats_enqueue(Cheat::Walls); | |
| 4174 | ✗ | return D_O_K; | |
| 4175 | ✗ | } | |
| 4176 | |||
| 4177 | ✗ | int32_t onIgnoreSideview() | |
| 4178 | { | ||
| 4179 | ✗ | cheats_enqueue(Cheat::IgnoreSideView); | |
| 4180 | ✗ | return D_O_K; | |
| 4181 | ✗ | } | |
| 4182 | |||
| 4183 | 9284954 | int32_t input_idle(bool checkmouse) | |
| 4184 | { | ||
| 4185 | static int32_t mx, my, mz, mb; | ||
| 4186 | |||
| 4187 |
4/6✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2461268 times.
✓ Branch 3 taken 6823686 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2461268 times.
|
11746222 | if(keypressed() || zc_key_pressed() || |
| 4188 |
4/8✓ Branch 0 taken 2461268 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2461268 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2461268 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2461268 times.
✗ Branch 7 not taken.
|
2461268 | (checkmouse && (mx != mouse_x || my != mouse_y || mz != mouse_z || mb != mouse_b))) |
| 4189 | { | ||
| 4190 | 6823686 | idle_count = 0; | |
| 4191 | |||
| 4192 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6823686 times.
|
6823686 | if(active_count < MAX_ACTIVE) |
| 4193 | { | ||
| 4194 | 6823686 | ++active_count; | |
| 4195 | 6823686 | } | |
| 4196 | 6823686 | } | |
| 4197 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2461268 times.
|
2461268 | else if(idle_count < MAX_IDLE) |
| 4198 | { | ||
| 4199 | 2461268 | ++idle_count; | |
| 4200 | 2461268 | active_count = 0; | |
| 4201 | 2461268 | } | |
| 4202 | |||
| 4203 | 9284954 | mx = mouse_x; | |
| 4204 | 9284954 | my = mouse_y; | |
| 4205 | 9284954 | mz = mouse_z; | |
| 4206 | 9284954 | mb = mouse_b; | |
| 4207 | |||
| 4208 | 9284954 | return idle_count; | |
| 4209 | } | ||
| 4210 | |||
| 4211 | ✗ | int32_t onGoFast() | |
| 4212 | { | ||
| 4213 | ✗ | cheats_enqueue(Cheat::Fast); | |
| 4214 | ✗ | return D_O_K; | |
| 4215 | ✗ | } | |
| 4216 | |||
| 4217 | ✗ | int32_t onKillCheat() | |
| 4218 | { | ||
| 4219 | ✗ | cheats_enqueue(Cheat::Kill); | |
| 4220 | ✗ | return D_O_K; | |
| 4221 | ✗ | } | |
| 4222 | |||
| 4223 | ✗ | int32_t onSecretsCheat() | |
| 4224 | { | ||
| 4225 | ✗ | cheats_enqueue(Cheat::TrigSecrets); | |
| 4226 | ✗ | return D_O_K; | |
| 4227 | ✗ | } | |
| 4228 | ✗ | int32_t onSecretsCheatPerm() | |
| 4229 | { | ||
| 4230 | ✗ | cheats_enqueue(Cheat::TrigSecretsPerm); | |
| 4231 | ✗ | return D_O_K; | |
| 4232 | ✗ | } | |
| 4233 | |||
| 4234 | ✗ | int32_t onShowLayer0() | |
| 4235 | { | ||
| 4236 | ✗ | show_layer_0 = !show_layer_0; | |
| 4237 | ✗ | return D_O_K; | |
| 4238 | } | ||
| 4239 | ✗ | int32_t onShowLayer1() | |
| 4240 | { | ||
| 4241 | ✗ | show_layer_1 = !show_layer_1; | |
| 4242 | ✗ | return D_O_K; | |
| 4243 | } | ||
| 4244 | ✗ | int32_t onShowLayer2() | |
| 4245 | { | ||
| 4246 | ✗ | show_layer_2 = !show_layer_2; | |
| 4247 | ✗ | return D_O_K; | |
| 4248 | } | ||
| 4249 | ✗ | int32_t onShowLayer3() | |
| 4250 | { | ||
| 4251 | ✗ | show_layer_3 = !show_layer_3; | |
| 4252 | ✗ | return D_O_K; | |
| 4253 | } | ||
| 4254 | ✗ | int32_t onShowLayer4() | |
| 4255 | { | ||
| 4256 | ✗ | show_layer_4 = !show_layer_4; | |
| 4257 | ✗ | return D_O_K; | |
| 4258 | } | ||
| 4259 | ✗ | int32_t onShowLayer5() | |
| 4260 | { | ||
| 4261 | ✗ | show_layer_5 = !show_layer_5; | |
| 4262 | ✗ | return D_O_K; | |
| 4263 | } | ||
| 4264 | ✗ | int32_t onShowLayer6() | |
| 4265 | { | ||
| 4266 | ✗ | show_layer_6 = !show_layer_6; | |
| 4267 | ✗ | return D_O_K; | |
| 4268 | } | ||
| 4269 | ✗ | int32_t onShowLayerO() | |
| 4270 | { | ||
| 4271 | ✗ | show_layer_over=!show_layer_over; | |
| 4272 | ✗ | return D_O_K; | |
| 4273 | } | ||
| 4274 | ✗ | int32_t onShowLayerP() | |
| 4275 | { | ||
| 4276 | ✗ | show_layer_push=!show_layer_push; | |
| 4277 | ✗ | return D_O_K; | |
| 4278 | } | ||
| 4279 | ✗ | int32_t onShowLayerS() | |
| 4280 | { | ||
| 4281 | ✗ | show_sprites=!show_sprites; | |
| 4282 | ✗ | return D_O_K; | |
| 4283 | } | ||
| 4284 | ✗ | int32_t onShowLayerF() | |
| 4285 | { | ||
| 4286 | ✗ | show_ffcs=!show_ffcs; | |
| 4287 | ✗ | return D_O_K; | |
| 4288 | } | ||
| 4289 | ✗ | int32_t onShowLayerW() | |
| 4290 | { | ||
| 4291 | ✗ | show_walkflags=!show_walkflags; | |
| 4292 | ✗ | if(show_walkflags) | |
| 4293 | ✗ | show_effectflags = false; | |
| 4294 | ✗ | return D_O_K; | |
| 4295 | } | ||
| 4296 | ✗ | int32_t onShowLayerE() | |
| 4297 | { | ||
| 4298 | ✗ | show_effectflags=!show_effectflags; | |
| 4299 | ✗ | if(show_effectflags) | |
| 4300 | ✗ | show_walkflags = false; | |
| 4301 | ✗ | return D_O_K; | |
| 4302 | } | ||
| 4303 | ✗ | int32_t onShowFFScripts() | |
| 4304 | { | ||
| 4305 | ✗ | show_ff_scripts=!show_ff_scripts; | |
| 4306 | ✗ | return D_O_K; | |
| 4307 | } | ||
| 4308 | ✗ | int32_t onShowHitboxes() | |
| 4309 | { | ||
| 4310 | ✗ | show_hitboxes=!show_hitboxes; | |
| 4311 | ✗ | return D_O_K; | |
| 4312 | } | ||
| 4313 | ✗ | int32_t onShowInfoOpacity() | |
| 4314 | { | ||
| 4315 | ✗ | info_opacity = vbound(getnumber("Debug Info Opacity",info_opacity),0,255); | |
| 4316 | ✗ | zc_set_config("zc","debug_info_opacity",info_opacity); | |
| 4317 | ✗ | return D_O_K; | |
| 4318 | } | ||
| 4319 | |||
| 4320 | ✗ | int32_t onLightSwitch() | |
| 4321 | { | ||
| 4322 | ✗ | cheats_enqueue(Cheat::Light); | |
| 4323 | ✗ | return D_O_K; | |
| 4324 | ✗ | } | |
| 4325 | |||
| 4326 | int32_t onGoTo(); | ||
| 4327 | int32_t onGoToComplete(); | ||
| 4328 | |||
| 4329 | 9284954 | void syskeys() | |
| 4330 | { | ||
| 4331 | 9284954 | update_system_keys(); | |
| 4332 | |||
| 4333 | int32_t oldtitle_version; | ||
| 4334 | |||
| 4335 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if(close_button_quit) |
| 4336 | { | ||
| 4337 | ✗ | close_button_quit=false; | |
| 4338 | ✗ | f_Quit(qEXIT); | |
| 4339 | ✗ | } | |
| 4340 | |||
| 4341 | 9284954 | poll_joystick(); | |
| 4342 | |||
| 4343 |
2/10✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 9284954 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
9284954 | if(rMbtn() || (gui_mouse_b() && !mouse_down && ClickToFreeze &&!disableClickToFreeze)) |
| 4344 | { | ||
| 4345 | ✗ | oldtitle_version=title_version; | |
| 4346 | ✗ | System(); | |
| 4347 | ✗ | } | |
| 4348 | |||
| 4349 | 9284954 | mouse_down=gui_mouse_b(); | |
| 4350 | |||
| 4351 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if(zc_read_system_key(KEY_F1)) |
| 4352 | { | ||
| 4353 | ✗ | if(zc_get_system_key(KEY_ZC_LCONTROL) || zc_get_system_key(KEY_ZC_RCONTROL)) | |
| 4354 | { | ||
| 4355 | ✗ | halt=!halt; | |
| 4356 | //zinit.subscreen=(zinit.subscreen+1)%ssdtMAX; | ||
| 4357 | ✗ | } | |
| 4358 | else | ||
| 4359 | { | ||
| 4360 | ✗ | Throttlefps=!Throttlefps; | |
| 4361 | ✗ | zc_set_config(cfg_sect,"throttlefps", (int32_t)Throttlefps); | |
| 4362 | } | ||
| 4363 | ✗ | } | |
| 4364 | |||
| 4365 | // if(zc_readkey(KEY_F1)) Vsync=!Vsync; | ||
| 4366 | /* | ||
| 4367 | if(zc_readkey(KEY_F1)) set_bit(QHeader.rules4,qr4_NEWENEMYTILES, | ||
| 4368 | 1-((get_bit(QHeader.rules4,qr4_NEWENEMYTILES)))); | ||
| 4369 | */ | ||
| 4370 | |||
| 4371 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if(zc_read_system_key(KEY_F2)) |
| 4372 | { | ||
| 4373 | ✗ | ShowFPS=!ShowFPS; | |
| 4374 | ✗ | zc_set_config(cfg_sect,"showfps",(int32_t)ShowFPS); | |
| 4375 | ✗ | } | |
| 4376 | |||
| 4377 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 9284954 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
9284954 | if(zc_read_system_key(KEY_F3) && Playing) Paused=!Paused; |
| 4378 | |||
| 4379 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 9284954 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
9284954 | if(zc_read_system_key(KEY_F4) && Playing) |
| 4380 | { | ||
| 4381 | ✗ | Paused=true; | |
| 4382 | ✗ | Advance=true; | |
| 4383 | ✗ | } | |
| 4384 | |||
| 4385 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if(zc_read_system_key(KEY_F6)) onTryQuit(); |
| 4386 | |||
| 4387 | #ifndef ALLEGRO_MACOSX | ||
| 4388 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if(zc_read_system_key(KEY_F9)) f_Quit(qRESET); |
| 4389 | |||
| 4390 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if(zc_read_system_key(KEY_F10)) f_Quit(qEXIT); |
| 4391 | #else | ||
| 4392 | if(zc_read_system_key(KEY_F7)) f_Quit(qRESET); | ||
| 4393 | |||
| 4394 | if(zc_read_system_key(KEY_F8)) f_Quit(qEXIT); | ||
| 4395 | #endif | ||
| 4396 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 9284954 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
9284954 | if(zc_read_system_key(KEY_F5)&&(Playing && currscr<128 && DMaps[currdmap].flags&dmfVIEWMAP)) onSaveMapPic(); |
| 4397 | |||
| 4398 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if (zc_read_system_key(KEY_F12)) |
| 4399 | { | ||
| 4400 | ✗ | onSnapshot(); | |
| 4401 | ✗ | } | |
| 4402 | |||
| 4403 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 9284954 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
9284954 | if(debug_enabled && zc_read_system_key(KEY_TAB)) |
| 4404 | ✗ | set_debug(!get_debug()); | |
| 4405 | |||
| 4406 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if(CheatModifierKeys()) |
| 4407 | { | ||
| 4408 | ✗ | for(Cheat c = (Cheat)1; c < Cheat::Last; c = (Cheat)(c+1)) | |
| 4409 | { | ||
| 4410 | ✗ | if(!bindable_cheat(c)) | |
| 4411 | ✗ | continue; | |
| 4412 | ✗ | if(get_debug() || cheat >= cheat_lvl(c)) | |
| 4413 | { | ||
| 4414 | ✗ | if(checkcheat(c)) | |
| 4415 | ✗ | cheats_hit_bind(c); | |
| 4416 | ✗ | } | |
| 4417 | ✗ | } | |
| 4418 | ✗ | } | |
| 4419 | |||
| 4420 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if(volkeys) |
| 4421 | { | ||
| 4422 | ✗ | if(zc_read_system_key(KEY_PGUP)) master_volume(-1,midi_volume+8); | |
| 4423 | |||
| 4424 | ✗ | if(zc_read_system_key(KEY_PGDN)) master_volume(-1,midi_volume==255?248:midi_volume-8); | |
| 4425 | |||
| 4426 | ✗ | if(zc_read_system_key(KEY_HOME)) master_volume(digi_volume+8,-1); | |
| 4427 | |||
| 4428 | ✗ | if(zc_read_system_key(KEY_END)) master_volume(digi_volume==255?248:digi_volume-8,-1); | |
| 4429 | ✗ | } | |
| 4430 | |||
| 4431 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 9284954 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
9284954 | if(!get_debug() || !SystemKeys || replay_is_replaying()) |
| 4432 | 9284954 | goto bottom; | |
| 4433 | |||
| 4434 | ✗ | if(zc_readkey(KEY_D)) | |
| 4435 | { | ||
| 4436 | ✗ | details = !details; | |
| 4437 | ✗ | rectfill(screen,0,0,319,7,BLACK); | |
| 4438 | ✗ | rectfill(screen,0,8,31,239,BLACK); | |
| 4439 | ✗ | rectfill(screen,288,8,319,239,BLACK); | |
| 4440 | ✗ | rectfill(screen,32,232,287,239,BLACK); | |
| 4441 | ✗ | } | |
| 4442 | |||
| 4443 | ✗ | if(zc_readkey(KEY_P)) Paused=!Paused; | |
| 4444 | |||
| 4445 | //if(zc_readkey(KEY_P)) centerHero(); | ||
| 4446 | ✗ | if(zc_readkey(KEY_A)) | |
| 4447 | { | ||
| 4448 | ✗ | Paused=true; | |
| 4449 | ✗ | Advance=true; | |
| 4450 | ✗ | } | |
| 4451 | |||
| 4452 | ✗ | if(zc_readkey(KEY_G)) db=(db==999)?0:999; | |
| 4453 | #ifndef ALLEGRO_MACOSX | ||
| 4454 | ✗ | if(zc_readkey(KEY_F8)) Showpal=!Showpal; | |
| 4455 | |||
| 4456 | ✗ | if(zc_readkey(KEY_F7)) | |
| 4457 | { | ||
| 4458 | ✗ | Matrix(ss_speed, ss_density, 0); | |
| 4459 | ✗ | game_pal(); | |
| 4460 | ✗ | } | |
| 4461 | #else | ||
| 4462 | // The reason these are different on Mac in the first place is that | ||
| 4463 | // the OS doesn't let us use F9 and F10... | ||
| 4464 | if(zc_readkey(KEY_F10)) Showpal=!Showpal; | ||
| 4465 | |||
| 4466 | if(zc_readkey(KEY_F9)) | ||
| 4467 | { | ||
| 4468 | Matrix(ss_speed, ss_density, 0); | ||
| 4469 | game_pal(); | ||
| 4470 | } | ||
| 4471 | #endif | ||
| 4472 | ✗ | if(zc_readkey(KEY_PLUS_PAD) || zc_readkey(KEY_EQUALS)) | |
| 4473 | { | ||
| 4474 | //change containers | ||
| 4475 | ✗ | if(zc_getkey(KEY_ZC_LCONTROL) || zc_getkey(KEY_ZC_RCONTROL)) | |
| 4476 | { | ||
| 4477 | //magic containers | ||
| 4478 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4479 | { | ||
| 4480 | ✗ | game->set_maxmagic(zc_min(game->get_maxmagic()+game->get_mp_per_block(),game->get_mp_per_block()*8)); | |
| 4481 | ✗ | } | |
| 4482 | else | ||
| 4483 | { | ||
| 4484 | ✗ | game->set_maxlife(zc_min(game->get_maxlife()+game->get_hp_per_heart(),game->get_hp_per_heart()*24)); | |
| 4485 | } | ||
| 4486 | ✗ | } | |
| 4487 | else | ||
| 4488 | { | ||
| 4489 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4490 | { | ||
| 4491 | ✗ | game->set_magic(zc_min(game->get_magic()+1,game->get_maxmagic())); | |
| 4492 | ✗ | } | |
| 4493 | else | ||
| 4494 | { | ||
| 4495 | ✗ | game->set_life(zc_min(game->get_life()+1,game->get_maxlife())); | |
| 4496 | } | ||
| 4497 | } | ||
| 4498 | ✗ | } | |
| 4499 | |||
| 4500 | ✗ | if(zc_readkey(KEY_MINUS_PAD) || zc_readkey(KEY_MINUS)) | |
| 4501 | { | ||
| 4502 | //change containers | ||
| 4503 | ✗ | if(zc_getkey(KEY_ZC_LCONTROL) || zc_getkey(KEY_ZC_RCONTROL)) | |
| 4504 | { | ||
| 4505 | //magic containers | ||
| 4506 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4507 | { | ||
| 4508 | ✗ | game->set_maxmagic(zc_max(game->get_maxmagic()-game->get_mp_per_block(),0)); | |
| 4509 | ✗ | game->set_magic(zc_min(game->get_maxmagic(), game->get_magic())); | |
| 4510 | //heart containers | ||
| 4511 | ✗ | } | |
| 4512 | else | ||
| 4513 | { | ||
| 4514 | ✗ | game->set_maxlife(zc_max(game->get_maxlife()-game->get_hp_per_heart(),game->get_hp_per_heart())); | |
| 4515 | ✗ | game->set_life(zc_min(game->get_maxlife(), game->get_life())); | |
| 4516 | } | ||
| 4517 | ✗ | } | |
| 4518 | else | ||
| 4519 | { | ||
| 4520 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4521 | { | ||
| 4522 | ✗ | game->set_magic(zc_max(game->get_magic()-1,0)); | |
| 4523 | ✗ | } | |
| 4524 | else | ||
| 4525 | { | ||
| 4526 | ✗ | game->set_life(zc_max(game->get_life()-1,0)); | |
| 4527 | } | ||
| 4528 | } | ||
| 4529 | ✗ | } | |
| 4530 | |||
| 4531 | ✗ | if(zc_readkey(KEY_COMMA)) jukebox(currmidi-1); | |
| 4532 | |||
| 4533 | ✗ | if(zc_readkey(KEY_STOP)) jukebox(currmidi+1); | |
| 4534 | |||
| 4535 | ✗ | verifyBothWeapons(); | |
| 4536 | |||
| 4537 | bottom: | ||
| 4538 | |||
| 4539 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if(input_idle(true) > after_time()) |
| 4540 | { | ||
| 4541 | ✗ | Matrix(ss_speed, ss_density, 0); | |
| 4542 | ✗ | game_pal(); | |
| 4543 | ✗ | } | |
| 4544 | 9284954 | } | |
| 4545 | |||
| 4546 | 708144 | void checkQuitKeys() | |
| 4547 | { | ||
| 4548 | #ifndef ALLEGRO_MACOSX | ||
| 4549 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 708144 times.
|
708144 | if(key[KEY_F9]) f_Quit(qRESET); |
| 4550 | |||
| 4551 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 708144 times.
|
708144 | if(key[KEY_F10]) f_Quit(qEXIT); |
| 4552 | #else | ||
| 4553 | if(key[KEY_F7]) f_Quit(qRESET); | ||
| 4554 | |||
| 4555 | if(key[KEY_F8]) f_Quit(qEXIT); | ||
| 4556 | #endif | ||
| 4557 | 708144 | } | |
| 4558 | |||
| 4559 | 9284954 | bool CheatModifierKeys() | |
| 4560 | { | ||
| 4561 | // Cheats are replayed via the X cheat step, no need to check for keyboard input | ||
| 4562 | // to trigger cheats. | ||
| 4563 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if (replay_is_replaying()) |
| 4564 | 9284954 | return false; | |
| 4565 | |||
| 4566 | ✗ | if ( ( cheat_modifier_keys[0] > 0 && key[cheat_modifier_keys[0]] ) || | |
| 4567 | ✗ | ( cheat_modifier_keys[1] > 0 && key[cheat_modifier_keys[1]] ) || | |
| 4568 | ✗ | (cheat_modifier_keys[0] <= 0 && cheat_modifier_keys[1] <= 0)) | |
| 4569 | { | ||
| 4570 | ✗ | if ( ( cheat_modifier_keys[2] <= 0 || key[cheat_modifier_keys[2]] ) || | |
| 4571 | ✗ | ( cheat_modifier_keys[3] > 0 && key[cheat_modifier_keys[3]] ) || | |
| 4572 | ✗ | (cheat_modifier_keys[2] <= 0 && cheat_modifier_keys[3] <= 0)) | |
| 4573 | { | ||
| 4574 | ✗ | return true; | |
| 4575 | } | ||
| 4576 | ✗ | } | |
| 4577 | ✗ | return false; | |
| 4578 | 9284954 | } | |
| 4579 | |||
| 4580 | //99:05:54, for some reason? | ||
| 4581 | #define OLDMAXTIME 21405240 | ||
| 4582 | //9000:00:00, the highest even-thousand hour fitting within 32b signed. This is 375 *DAYS*. | ||
| 4583 | #define MAXTIME 1944000000 | ||
| 4584 | |||
| 4585 | 9285079 | void advanceframe(bool allowwavy, bool sfxcleanup, bool allowF6Script) | |
| 4586 | { | ||
| 4587 |
2/2✓ Branch 0 taken 9164956 times.
✓ Branch 1 taken 120123 times.
|
9285079 | if(zcmusic!=NULL) |
| 4588 | { | ||
| 4589 | 120123 | zcmusic_poll(); | |
| 4590 | 120123 | } | |
| 4591 | |||
| 4592 | 9285079 | updatescr(allowwavy); | |
| 4593 | |||
| 4594 | 9285079 | Advance=false; | |
| 4595 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 9285079 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9285079 times.
|
9285079 | while(Paused && !Advance && !Quit) |
| 4596 | { | ||
| 4597 | // have to call this, otherwise we'll get an infinite loop | ||
| 4598 | ✗ | syskeys(); | |
| 4599 | ✗ | if(allowF6Script) | |
| 4600 | { | ||
| 4601 | ✗ | FFCore.runF6Engine(); | |
| 4602 | ✗ | } | |
| 4603 | ✗ | throttleFPS(); | |
| 4604 | |||
| 4605 | #ifdef _WIN32 | ||
| 4606 | |||
| 4607 | if(use_dwm_flush) | ||
| 4608 | { | ||
| 4609 | do_DwmFlush(); | ||
| 4610 | } | ||
| 4611 | |||
| 4612 | #endif | ||
| 4613 | |||
| 4614 | // to keep music playing | ||
| 4615 | ✗ | if(zcmusic!=NULL) | |
| 4616 | { | ||
| 4617 | ✗ | zcmusic_poll(); | |
| 4618 | ✗ | } | |
| 4619 | |||
| 4620 | ✗ | update_hw_screen(); | |
| 4621 | } | ||
| 4622 | |||
| 4623 |
2/2✓ Branch 0 taken 9284967 times.
✓ Branch 1 taken 112 times.
|
9285079 | if(Quit) |
| 4624 | 112 | return; | |
| 4625 | |||
| 4626 |
3/4✓ Branch 0 taken 8984007 times.
✓ Branch 1 taken 300960 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8984007 times.
|
9284967 | if(Playing && game->get_time()<unsigned(get_qr(qr_GREATER_MAX_TIME) ? MAXTIME : OLDMAXTIME)) |
| 4627 | 8984007 | game->change_time(1); | |
| 4628 | |||
| 4629 | // Many mistakes have been make re: inputs, and we are stuck with many replays relying on those mistakes. | ||
| 4630 | |||
| 4631 | 9284967 | bool should_reset_down_state = !get_qr(qr_BROKEN_INPUT_DOWN_STATE); | |
| 4632 |
2/2✓ Branch 0 taken 18170 times.
✓ Branch 1 taken 9266797 times.
|
9284967 | if (replay_version_check(0, 16)) |
| 4633 | 9266797 | should_reset_down_state = replay_version_check(11, 16); | |
| 4634 |
2/2✓ Branch 0 taken 6949680 times.
✓ Branch 1 taken 2335287 times.
|
9284967 | if (should_reset_down_state) |
| 4635 | { | ||
| 4636 |
2/2✓ Branch 0 taken 42035166 times.
✓ Branch 1 taken 2335287 times.
|
44370453 | for (int i = 0; i < ZC_CONTROL_STATES; i++) |
| 4637 | 42035166 | down_control_states[i] = raw_control_state[i]; | |
| 4638 | 2335287 | } | |
| 4639 | |||
| 4640 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 9284972 times.
|
9284967 | if (replay_is_active()) |
| 4641 | { | ||
| 4642 |
2/2✓ Branch 0 taken 1270468 times.
✓ Branch 1 taken 8014504 times.
|
9284972 | if (replay_version_check(3)) |
| 4643 | 8014504 | replay_poll(); | |
| 4644 | |||
| 4645 |
4/4✓ Branch 0 taken 6946098 times.
✓ Branch 1 taken 2338856 times.
✓ Branch 2 taken 100535 times.
✓ Branch 3 taken 6845563 times.
|
9284972 | if (replay_version_check(11) || replay_version_check(6, 8)) |
| 4646 | 2439391 | replay_peek_input(); | |
| 4647 | 9284954 | } | |
| 4648 | |||
| 4649 | 9284967 | load_control_called_this_frame = false; | |
| 4650 | |||
| 4651 | 9284967 | poll_keyboard(); | |
| 4652 | 9284967 | update_keys(); | |
| 4653 | |||
| 4654 | 9284967 | ++frame; | |
| 4655 | |||
| 4656 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 9284954 times.
|
9284967 | if (replay_is_replaying()) |
| 4657 | 9284954 | replay_do_cheats(); | |
| 4658 | 9284967 | syskeys(); | |
| 4659 | |||
| 4660 | // The mouse variables can change from the mouse thread at anytime during a frame, | ||
| 4661 | // so save the result at the start so that replaying is consistent. | ||
| 4662 | 9284967 | script_mouse_x = gui_mouse_x(); | |
| 4663 | 9284967 | script_mouse_y = gui_mouse_y(); | |
| 4664 | 9284967 | script_mouse_z = mouse_z; | |
| 4665 | 9284967 | script_mouse_b = mouse_b; | |
| 4666 | |||
| 4667 | // Cheats used via the System menu (called by syskeys) will call cheats_enqueue. syskeys | ||
| 4668 | // is called just above, and in the paused loop above, so the queue-and-defer-slightly | ||
| 4669 | // approach here means it doesn't matter which call adds the cheat. | ||
| 4670 | 9284967 | cheats_execute_queued(); | |
| 4671 | |||
| 4672 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 9284954 times.
|
9284967 | if (replay_is_replaying()) |
| 4673 | 9284954 | replay_peek_quit(); | |
| 4674 |
2/2✓ Branch 0 taken 9284954 times.
✓ Branch 1 taken 13 times.
|
9284967 | if (GameFlags & GAMEFLAG_TRYQUIT) |
| 4675 | 13 | replay_step_quit(0); | |
| 4676 |
2/2✓ Branch 0 taken 2933 times.
✓ Branch 1 taken 9282034 times.
|
9284967 | if(allowF6Script) |
| 4677 | 9282034 | FFCore.runF6Engine(); | |
| 4678 |
2/2✓ Branch 0 taken 9284667 times.
✓ Branch 1 taken 300 times.
|
9284967 | if (Quit) |
| 4679 | 300 | replay_step_quit(Quit); | |
| 4680 | // Someday... maybe install a Turbo button here? | ||
| 4681 | 9284967 | throttleFPS(); | |
| 4682 | |||
| 4683 | #ifdef _WIN32 | ||
| 4684 | |||
| 4685 | if(use_dwm_flush) | ||
| 4686 | { | ||
| 4687 | do_DwmFlush(); | ||
| 4688 | } | ||
| 4689 | |||
| 4690 | #endif | ||
| 4691 | |||
| 4692 | //textprintf_ex(screen,font,0,72,254,BLACK,"%d %d", lastentrance, lastentrance_dmap); | ||
| 4693 |
2/2✓ Branch 0 taken 68757 times.
✓ Branch 1 taken 9216210 times.
|
9284967 | if(sfxcleanup) |
| 4694 | 9216210 | sfx_cleanup(); | |
| 4695 | |||
| 4696 | 9284967 | jit_poll(); | |
| 4697 | 9285079 | } | |
| 4698 | |||
| 4699 | 101 | void zapout() | |
| 4700 | { | ||
| 4701 | 101 | set_clip_rect(scrollbuf, 0, 0, scrollbuf->w, scrollbuf->h); | |
| 4702 | 101 | blit(framebuf,scrollbuf,0,0,256,0,256,224); | |
| 4703 | |||
| 4704 | 101 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4705 | 101 | script_drawing_commands.Clear(); | |
| 4706 | |||
| 4707 | // zap out | ||
| 4708 |
2/2✓ Branch 0 taken 101 times.
✓ Branch 1 taken 2424 times.
|
2525 | for(int32_t i=1; i<=24; i++) |
| 4709 | { | ||
| 4710 | 2424 | draw_fuzzy(i); | |
| 4711 | 2424 | advanceframe(true); | |
| 4712 | |||
| 4713 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2424 times.
|
2424 | if(Quit) |
| 4714 | { | ||
| 4715 | ✗ | break; | |
| 4716 | } | ||
| 4717 | 2424 | } | |
| 4718 | 101 | } | |
| 4719 | |||
| 4720 | 101 | void zapin() | |
| 4721 | { | ||
| 4722 | 101 | FFCore.warpScriptCheck(); | |
| 4723 | 101 | draw_screen(tmpscr); | |
| 4724 | 101 | set_clip_rect(scrollbuf, 0, 0, scrollbuf->w, scrollbuf->h); | |
| 4725 | //put_passive_subscr(framebuf,0,passive_subscreen_offset,false,sspUP); | ||
| 4726 | 101 | blit(framebuf,scrollbuf,0,0,256,0,256,224); | |
| 4727 | |||
| 4728 | // zap out | ||
| 4729 | 101 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4730 |
2/2✓ Branch 0 taken 101 times.
✓ Branch 1 taken 2424 times.
|
2525 | for(int32_t i=24; i>=1; i--) |
| 4731 | { | ||
| 4732 | 2424 | draw_fuzzy(i); | |
| 4733 | 2424 | advanceframe(true); | |
| 4734 | |||
| 4735 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2424 times.
|
2424 | if(Quit) |
| 4736 | { | ||
| 4737 | ✗ | break; | |
| 4738 | } | ||
| 4739 | 2424 | } | |
| 4740 | 101 | } | |
| 4741 | |||
| 4742 | |||
| 4743 | 65 | void wavyout(bool showhero) | |
| 4744 | { | ||
| 4745 | 65 | draw_screen(tmpscr, showhero); | |
| 4746 | //put_passive_subscr(framebuf,0,passive_subscreen_offset,false,sspUP); | ||
| 4747 | |||
| 4748 | 65 | BITMAP *wavebuf = create_bitmap_ex(8,288,224); | |
| 4749 | 65 | clear_to_color(wavebuf,0); | |
| 4750 | 65 | blit(framebuf,wavebuf,0,0,16,0,256,224); | |
| 4751 | |||
| 4752 | static PALETTE wavepal; | ||
| 4753 | |||
| 4754 | int32_t ofs; | ||
| 4755 | 65 | int32_t amplitude=8; | |
| 4756 | |||
| 4757 | 65 | int32_t wavelength=4; | |
| 4758 | 65 | double palpos=0, palstep=4, palstop=126; | |
| 4759 | |||
| 4760 | 65 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4761 |
2/2✓ Branch 0 taken 65 times.
✓ Branch 1 taken 2730 times.
|
2795 | for(int32_t i=0; i<168; i+=wavelength) |
| 4762 | { | ||
| 4763 |
2/2✓ Branch 0 taken 698880 times.
✓ Branch 1 taken 2730 times.
|
701610 | for(int32_t l=0; l<256; l++) |
| 4764 | { | ||
| 4765 | 698880 | wavepal[l].r=vbound(int32_t(RAMpal[l].r+((palpos/palstop)*(63-RAMpal[l].r))),0,63); | |
| 4766 | 698880 | wavepal[l].g=vbound(int32_t(RAMpal[l].g+((palpos/palstop)*(63-RAMpal[l].g))),0,63); | |
| 4767 | 698880 | wavepal[l].b=vbound(int32_t(RAMpal[l].b+((palpos/palstop)*(63-RAMpal[l].b))),0,63); | |
| 4768 | 698880 | } | |
| 4769 | |||
| 4770 | 2730 | palpos+=palstep; | |
| 4771 | |||
| 4772 |
1/2✓ Branch 0 taken 2730 times.
✗ Branch 1 not taken.
|
2730 | if(palpos>=0) |
| 4773 | { | ||
| 4774 | 2730 | hw_palette = &wavepal; | |
| 4775 | 2730 | update_hw_pal = true; | |
| 4776 | 2730 | } | |
| 4777 | else | ||
| 4778 | { | ||
| 4779 | ✗ | hw_palette = &RAMpal; | |
| 4780 | ✗ | update_hw_pal = true; | |
| 4781 | } | ||
| 4782 | |||
| 4783 |
2/2✓ Branch 0 taken 458640 times.
✓ Branch 1 taken 2730 times.
|
461370 | for(int32_t j=0; j+playing_field_offset<224; j++) |
| 4784 | { | ||
| 4785 |
2/2✓ Branch 0 taken 117411840 times.
✓ Branch 1 taken 458640 times.
|
117870480 | for(int32_t k=0; k<256; k++) |
| 4786 | { | ||
| 4787 | 117411840 | ofs=0; | |
| 4788 | |||
| 4789 |
4/4✓ Branch 0 taken 57308160 times.
✓ Branch 1 taken 60103680 times.
✓ Branch 2 taken 28654080 times.
✓ Branch 3 taken 28654080 times.
|
117411840 | if((j<i)&&(j&1)) |
| 4790 | { | ||
| 4791 | 28654080 | ofs=int32_t(zc::math::Sin((double(i+j)*2*PI/168.0))*amplitude); | |
| 4792 | 28654080 | } | |
| 4793 | |||
| 4794 | 117411840 | framebuf->line[j+playing_field_offset][k]=wavebuf->line[j+playing_field_offset][k+ofs+16]; | |
| 4795 | 117411840 | } | |
| 4796 | 458640 | } | |
| 4797 | |||
| 4798 | 2730 | advanceframe(true); | |
| 4799 | |||
| 4800 | // animate_combos(); | ||
| 4801 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2730 times.
|
2730 | if(Quit) |
| 4802 | ✗ | break; | |
| 4803 | 2730 | } | |
| 4804 | |||
| 4805 | 65 | destroy_bitmap(wavebuf); | |
| 4806 | 65 | } | |
| 4807 | |||
| 4808 | 65 | void wavyin() | |
| 4809 | { | ||
| 4810 | 65 | draw_screen(tmpscr); | |
| 4811 | //put_passive_subscr(framebuf,0,passive_subscreen_offset,false,sspUP); | ||
| 4812 | |||
| 4813 | 65 | BITMAP *wavebuf = create_bitmap_ex(8,288,224); | |
| 4814 | 65 | clear_to_color(wavebuf,0); | |
| 4815 | 65 | blit(framebuf,wavebuf,0,0,16,0,256,224); | |
| 4816 | |||
| 4817 | static PALETTE wavepal; | ||
| 4818 | |||
| 4819 | //Breaks dark rooms. | ||
| 4820 | //In any case I don't think we need this, since palette is already loaded in doWarp() (famous last words...) -DD | ||
| 4821 | /* | ||
| 4822 | loadfullpal(); | ||
| 4823 | loadlvlpal(DMaps[currdmap].color); | ||
| 4824 | ringcolor(false); | ||
| 4825 | */ | ||
| 4826 | 65 | refreshpal=false; | |
| 4827 | int32_t ofs; | ||
| 4828 | 65 | int32_t amplitude=8; | |
| 4829 | 65 | int32_t wavelength=4; | |
| 4830 | 65 | double palpos=168, palstep=4, palstop=126; | |
| 4831 | |||
| 4832 | 65 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4833 |
2/2✓ Branch 0 taken 65 times.
✓ Branch 1 taken 2730 times.
|
2795 | for(int32_t i=0; i<168; i+=wavelength) |
| 4834 | { | ||
| 4835 |
2/2✓ Branch 0 taken 698880 times.
✓ Branch 1 taken 2730 times.
|
701610 | for(int32_t l=0; l<256; l++) |
| 4836 | { | ||
| 4837 | 698880 | wavepal[l].r=vbound(int32_t(RAMpal[l].r+((palpos/palstop)*(63-RAMpal[l].r))),0,63); | |
| 4838 | 698880 | wavepal[l].g=vbound(int32_t(RAMpal[l].g+((palpos/palstop)*(63-RAMpal[l].g))),0,63); | |
| 4839 | 698880 | wavepal[l].b=vbound(int32_t(RAMpal[l].b+((palpos/palstop)*(63-RAMpal[l].b))),0,63); | |
| 4840 | 698880 | } | |
| 4841 | |||
| 4842 | 2730 | palpos-=palstep; | |
| 4843 | |||
| 4844 |
1/2✓ Branch 0 taken 2730 times.
✗ Branch 1 not taken.
|
2730 | if(palpos>=0) |
| 4845 | { | ||
| 4846 | 2730 | hw_palette = &wavepal; | |
| 4847 | 2730 | update_hw_pal = true; | |
| 4848 | 2730 | } | |
| 4849 | else | ||
| 4850 | { | ||
| 4851 | ✗ | hw_palette = &RAMpal; | |
| 4852 | ✗ | update_hw_pal = true; | |
| 4853 | } | ||
| 4854 | |||
| 4855 |
2/2✓ Branch 0 taken 458640 times.
✓ Branch 1 taken 2730 times.
|
461370 | for(int32_t j=0; j+playing_field_offset<224; j++) |
| 4856 | { | ||
| 4857 |
2/2✓ Branch 0 taken 117411840 times.
✓ Branch 1 taken 458640 times.
|
117870480 | for(int32_t k=0; k<256; k++) |
| 4858 | { | ||
| 4859 | 117411840 | ofs=0; | |
| 4860 | |||
| 4861 |
4/4✓ Branch 0 taken 59404800 times.
✓ Branch 1 taken 58007040 times.
✓ Branch 2 taken 30051840 times.
✓ Branch 3 taken 29352960 times.
|
117411840 | if((j<(167-i))&&(j&1)) |
| 4862 | { | ||
| 4863 | 29352960 | ofs=int32_t(zc::math::Sin((double(i+j)*2*PI/168.0))*amplitude); | |
| 4864 | 29352960 | } | |
| 4865 | |||
| 4866 | 117411840 | framebuf->line[j+playing_field_offset][k]=wavebuf->line[j+playing_field_offset][k+ofs+16]; | |
| 4867 | 117411840 | } | |
| 4868 | 458640 | } | |
| 4869 | |||
| 4870 | 2730 | advanceframe(true); | |
| 4871 | // animate_combos(); | ||
| 4872 | |||
| 4873 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2730 times.
|
2730 | if(Quit) |
| 4874 | ✗ | break; | |
| 4875 | 2730 | } | |
| 4876 | |||
| 4877 | 65 | destroy_bitmap(wavebuf); | |
| 4878 | 65 | } | |
| 4879 | |||
| 4880 | 2168 | void blackscr(int32_t fcnt,bool showsubscr) | |
| 4881 | { | ||
| 4882 | 2168 | reset_pal_cycling(); | |
| 4883 | 2168 | script_drawing_commands.Clear(); | |
| 4884 | |||
| 4885 | 2168 | FFCore.warpScriptCheck(); | |
| 4886 | 2168 | bool showtime = game->should_show_time(); | |
| 4887 |
2/2✓ Branch 0 taken 2168 times.
✓ Branch 1 taken 64970 times.
|
67138 | while(fcnt>0) |
| 4888 | { | ||
| 4889 | 64970 | clear_bitmap(framebuf); | |
| 4890 | |||
| 4891 |
2/2✓ Branch 0 taken 25080 times.
✓ Branch 1 taken 39890 times.
|
64970 | if(showsubscr) |
| 4892 | { | ||
| 4893 | 39890 | put_passive_subscr(framebuf,0,passive_subscreen_offset,showtime,sspUP); | |
| 4894 |
3/4✓ Branch 0 taken 39890 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 750 times.
✓ Branch 3 taken 39140 times.
|
39890 | if(get_qr(qr_SCRIPTDRAWSINWARPS) || (get_qr(qr_PASSIVE_SUBSCRIPT_RUNS_WHEN_GAME_IS_FROZEN))) |
| 4895 | { | ||
| 4896 | 750 | do_script_draws(framebuf, tmpscr, 0, playing_field_offset); | |
| 4897 | 750 | } | |
| 4898 | 39890 | } | |
| 4899 | |||
| 4900 | 64970 | advanceframe(true); | |
| 4901 | |||
| 4902 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 64970 times.
|
64970 | if(Quit) |
| 4903 | ✗ | break; | |
| 4904 | |||
| 4905 | 64970 | --fcnt; | |
| 4906 | } | ||
| 4907 | 2168 | } | |
| 4908 | |||
| 4909 | 1011 | void openscreen(int32_t shape) | |
| 4910 | { | ||
| 4911 | 1011 | reset_pal_cycling(); | |
| 4912 | 1011 | black_opening_count=0; | |
| 4913 | |||
| 4914 |
3/4✓ Branch 0 taken 100 times.
✓ Branch 1 taken 911 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 100 times.
|
1011 | if(COOLSCROLL || shape>-1) |
| 4915 | { | ||
| 4916 | 911 | open_black_opening(HeroX()+8, (HeroY()-HeroZ()-HeroFakeZ())+8+playing_field_offset, true, shape); | |
| 4917 | 911 | return; | |
| 4918 | } | ||
| 4919 | else | ||
| 4920 | { | ||
| 4921 | 100 | Hero.setDontDraw(true); | |
| 4922 | 100 | show_subscreen_dmap_dots=false; | |
| 4923 | 100 | show_subscreen_numbers=false; | |
| 4924 | // show_subscreen_items=false; | ||
| 4925 | 100 | show_subscreen_life=false; | |
| 4926 | } | ||
| 4927 | |||
| 4928 | 100 | int32_t x=128; | |
| 4929 | |||
| 4930 | 100 | FFCore.warpScriptCheck(); | |
| 4931 |
2/2✓ Branch 0 taken 100 times.
✓ Branch 1 taken 8000 times.
|
8100 | for(int32_t i=0; i<80; i++) |
| 4932 | { | ||
| 4933 | 8000 | draw_screen(tmpscr); | |
| 4934 | //? draw_screen already draws the subscreen -DD | ||
| 4935 | //put_passive_subscr(framebuf,0,passive_subscreen_offset,false,sspUP); | ||
| 4936 | 8000 | x=128-(((i*128/80)/8)*8); | |
| 4937 | |||
| 4938 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8000 times.
|
8000 | if(x>0) |
| 4939 | { | ||
| 4940 | 8000 | rectfill(framebuf,0,playing_field_offset,x,167+playing_field_offset,0); | |
| 4941 | 8000 | rectfill(framebuf,256-x,playing_field_offset,255,167+playing_field_offset,0); | |
| 4942 | 8000 | } | |
| 4943 | |||
| 4944 | 8000 | advanceframe(true); | |
| 4945 | |||
| 4946 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8000 times.
|
8000 | if(Quit) |
| 4947 | { | ||
| 4948 | ✗ | break; | |
| 4949 | } | ||
| 4950 | 8000 | } | |
| 4951 | |||
| 4952 | 100 | Hero.setDontDraw(false); | |
| 4953 | 100 | show_subscreen_items=true; | |
| 4954 | 100 | show_subscreen_dmap_dots=true; | |
| 4955 | 1011 | } | |
| 4956 | |||
| 4957 | ✗ | void closescreen(int32_t shape) | |
| 4958 | { | ||
| 4959 | ✗ | reset_pal_cycling(); | |
| 4960 | ✗ | black_opening_count=0; | |
| 4961 | |||
| 4962 | ✗ | if(COOLSCROLL || shape>-1) | |
| 4963 | { | ||
| 4964 | ✗ | close_black_opening(HeroX()+8, (HeroY()-HeroZ()-HeroFakeZ())+8+playing_field_offset, true, shape); | |
| 4965 | ✗ | return; | |
| 4966 | } | ||
| 4967 | else | ||
| 4968 | { | ||
| 4969 | ✗ | Hero.setDontDraw(true); | |
| 4970 | ✗ | show_subscreen_dmap_dots=false; | |
| 4971 | ✗ | show_subscreen_numbers=false; | |
| 4972 | // show_subscreen_items=false; | ||
| 4973 | ✗ | show_subscreen_life=false; | |
| 4974 | } | ||
| 4975 | |||
| 4976 | ✗ | int32_t x=128; | |
| 4977 | |||
| 4978 | ✗ | FFCore.warpScriptCheck(); | |
| 4979 | ✗ | for(int32_t i=79; i>=0; --i) | |
| 4980 | { | ||
| 4981 | ✗ | draw_screen(tmpscr); | |
| 4982 | //? draw_screen already draws the subscreen -DD | ||
| 4983 | //put_passive_subscr(framebuf,0,passive_subscreen_offset,false,sspUP); | ||
| 4984 | ✗ | x=128-(((i*128/80)/8)*8); | |
| 4985 | |||
| 4986 | ✗ | if(x>0) | |
| 4987 | { | ||
| 4988 | ✗ | rectfill(framebuf,0,playing_field_offset,x,167+playing_field_offset,0); | |
| 4989 | ✗ | rectfill(framebuf,256-x,playing_field_offset,255,167+playing_field_offset,0); | |
| 4990 | ✗ | } | |
| 4991 | |||
| 4992 | ✗ | advanceframe(true); | |
| 4993 | |||
| 4994 | ✗ | if(Quit) | |
| 4995 | { | ||
| 4996 | ✗ | break; | |
| 4997 | } | ||
| 4998 | ✗ | } | |
| 4999 | |||
| 5000 | ✗ | Hero.setDontDraw(false); | |
| 5001 | ✗ | show_subscreen_items=true; | |
| 5002 | ✗ | show_subscreen_dmap_dots=true; | |
| 5003 | ✗ | } | |
| 5004 | |||
| 5005 | 179 | int32_t TriforceCount() | |
| 5006 | { | ||
| 5007 | 179 | int32_t c=0; | |
| 5008 | |||
| 5009 |
2/2✓ Branch 0 taken 1432 times.
✓ Branch 1 taken 179 times.
|
1611 | for(int32_t i=1; i<=8; i++) |
| 5010 |
2/2✓ Branch 0 taken 388 times.
✓ Branch 1 taken 1044 times.
|
2476 | if(game->lvlitems[i]&liTRIFORCE) |
| 5011 | 1044 | ++c; | |
| 5012 | |||
| 5013 | 179 | return c; | |
| 5014 | } | ||
| 5015 | |||
| 5016 | ✗ | int32_t onCustomGame() | |
| 5017 | { | ||
| 5018 | ✗ | int32_t file = getsaveslot(); | |
| 5019 | |||
| 5020 | ✗ | if(file < 0) | |
| 5021 | ✗ | return D_O_K; | |
| 5022 | |||
| 5023 | ✗ | bool ret = (custom_game(file)!=0); | |
| 5024 | ✗ | return ret ? D_CLOSE : D_O_K; | |
| 5025 | ✗ | } | |
| 5026 | |||
| 5027 | ✗ | int32_t onContinue() | |
| 5028 | { | ||
| 5029 | ✗ | return D_CLOSE; | |
| 5030 | } | ||
| 5031 | |||
| 5032 | ✗ | int32_t onEsc() // Unused?? -L | |
| 5033 | { | ||
| 5034 | ✗ | return zc_getrawkey(KEY_ESC, true)?D_CLOSE:D_O_K; | |
| 5035 | } | ||
| 5036 | |||
| 5037 | ✗ | int32_t onVsync() | |
| 5038 | { | ||
| 5039 | ✗ | Throttlefps = !Throttlefps; | |
| 5040 | ✗ | zc_set_config(cfg_sect,"throttlefps", (int32_t)Throttlefps); | |
| 5041 | ✗ | return D_O_K; | |
| 5042 | } | ||
| 5043 | |||
| 5044 | ✗ | int32_t onWinPosSave() | |
| 5045 | { | ||
| 5046 | ✗ | SaveWinPos = !SaveWinPos; | |
| 5047 | ✗ | zc_set_config(cfg_sect,"save_window_position",(int32_t)SaveWinPos); | |
| 5048 | ✗ | return D_O_K; | |
| 5049 | } | ||
| 5050 | ✗ | int32_t onIntegerScaling() | |
| 5051 | { | ||
| 5052 | ✗ | scaleForceInteger = !scaleForceInteger; | |
| 5053 | ✗ | zc_set_config("zeldadx","scaling_force_integer",(int)scaleForceInteger); | |
| 5054 | ✗ | return D_O_K; | |
| 5055 | } | ||
| 5056 | ✗ | int32_t onStretchGame() | |
| 5057 | { | ||
| 5058 | ✗ | stretchGame = !stretchGame; | |
| 5059 | ✗ | zc_set_config("zeldadx","stretch_game_area",stretchGame?1:0); | |
| 5060 | ✗ | return D_O_K; | |
| 5061 | } | ||
| 5062 | |||
| 5063 | ✗ | int32_t onClickToFreeze() | |
| 5064 | { | ||
| 5065 | ✗ | ClickToFreeze = !ClickToFreeze; | |
| 5066 | ✗ | zc_set_config(cfg_sect,"clicktofreeze", (int32_t)ClickToFreeze); | |
| 5067 | ✗ | return D_O_K; | |
| 5068 | } | ||
| 5069 | |||
| 5070 | ✗ | int32_t OnSaveZCConfig() | |
| 5071 | { | ||
| 5072 | ✗ | if(jwin_alert3( | |
| 5073 | "Save Configuration", | ||
| 5074 | "Are you sure that you wish to save your present configuration settings?", | ||
| 5075 | "This will overwrite your prior settings!", | ||
| 5076 | NULL, | ||
| 5077 | "&Yes", | ||
| 5078 | "&No", | ||
| 5079 | NULL, | ||
| 5080 | 'y', | ||
| 5081 | 'n', | ||
| 5082 | 0, | ||
| 5083 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 5084 | { | ||
| 5085 | ✗ | save_game_configs(); | |
| 5086 | ✗ | return D_O_K; | |
| 5087 | } | ||
| 5088 | ✗ | else return D_O_K; | |
| 5089 | ✗ | } | |
| 5090 | |||
| 5091 | ✗ | int32_t OnnClearQuestDir() | |
| 5092 | { | ||
| 5093 | ✗ | if(jwin_alert3( | |
| 5094 | "Clear Current Directory Cache", | ||
| 5095 | "Are you sure that you wish to clear the current cached directory?", | ||
| 5096 | "This will default the current directory to the ROOT for this instance of ZC Player!", | ||
| 5097 | NULL, | ||
| 5098 | "&Yes", | ||
| 5099 | "&No", | ||
| 5100 | NULL, | ||
| 5101 | 'y', | ||
| 5102 | 'n', | ||
| 5103 | 0, | ||
| 5104 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 5105 | { | ||
| 5106 | ✗ | zc_set_config("zeldadx","win_qst_dir",""); | |
| 5107 | ✗ | flush_config_file(); | |
| 5108 | ✗ | strcpy(qstdir,""); | |
| 5109 | #ifdef __EMSCRIPTEN__ | ||
| 5110 | em_sync_fs(); | ||
| 5111 | #endif | ||
| 5112 | ✗ | return D_O_K; | |
| 5113 | } | ||
| 5114 | ✗ | else return D_O_K; | |
| 5115 | ✗ | } | |
| 5116 | |||
| 5117 | |||
| 5118 | ✗ | int32_t onConsoleZASM() | |
| 5119 | { | ||
| 5120 | ✗ | if ( !zasm_debugger ) | |
| 5121 | { | ||
| 5122 | ✗ | AlertDialog("WARNING: ZASM Debugger", | |
| 5123 | ✗ | "Enabling this will open the ZASM Debugger Console" | |
| 5124 | "\nThis will likely grind ZC to a halt with lag." | ||
| 5125 | "\nTo make any use of this, it is suggested that you read" | ||
| 5126 | "\nthe documentation for 'void Breakpoint(char[] string);'" | ||
| 5127 | " in 'ZScript_Additions.txt'" | ||
| 5128 | "\nThis is not recommended for normal users," | ||
| 5129 | " and is only intended for ZC developers," | ||
| 5130 | "\nor quest developers coding directly in ZASM" | ||
| 5131 | "\nAre you sure that you wish to open the ZASM Debugger?", | ||
| 5132 | ✗ | [&](bool ret,bool) | |
| 5133 | { | ||
| 5134 | ✗ | if(ret) | |
| 5135 | { | ||
| 5136 | ✗ | FFCore.ZASMPrint(true); | |
| 5137 | ✗ | } | |
| 5138 | ✗ | }).show(); | |
| 5139 | ✗ | return D_O_K; | |
| 5140 | } | ||
| 5141 | else | ||
| 5142 | { | ||
| 5143 | ✗ | FFCore.ZASMPrint(false); | |
| 5144 | ✗ | return D_O_K; | |
| 5145 | } | ||
| 5146 | ✗ | } | |
| 5147 | |||
| 5148 | |||
| 5149 | ✗ | int32_t onConsoleZScript() | |
| 5150 | { | ||
| 5151 | ✗ | if ( !zscript_debugger ) | |
| 5152 | { | ||
| 5153 | ✗ | AlertDialog("ZScript Debugger", | |
| 5154 | ✗ | "Enabling this will open the ZScript Debugger Console" | |
| 5155 | "\nThis will display any messages logged by scripts," | ||
| 5156 | " including script errors." | ||
| 5157 | "\nAre you sure that you wish to open the ZScript Debugger?", | ||
| 5158 | ✗ | [&](bool ret,bool) | |
| 5159 | { | ||
| 5160 | ✗ | if(ret) | |
| 5161 | { | ||
| 5162 | ✗ | FFCore.ZScriptConsole(true); | |
| 5163 | ✗ | } | |
| 5164 | ✗ | }).show(); | |
| 5165 | ✗ | return D_O_K; | |
| 5166 | } | ||
| 5167 | else | ||
| 5168 | { | ||
| 5169 | ✗ | FFCore.ZScriptConsole(false); | |
| 5170 | ✗ | return D_O_K; | |
| 5171 | } | ||
| 5172 | ✗ | } | |
| 5173 | |||
| 5174 | ✗ | int32_t onClrConsoleOnReload() | |
| 5175 | { | ||
| 5176 | ✗ | clearConsoleOnReload = !clearConsoleOnReload; | |
| 5177 | ✗ | zc_set_config("CONSOLE","clear_console_on_reload",clearConsoleOnReload?1:0); | |
| 5178 | ✗ | return D_O_K; | |
| 5179 | } | ||
| 5180 | ✗ | int32_t onClrConsoleOnLoad() | |
| 5181 | { | ||
| 5182 | ✗ | clearConsoleOnLoad = !clearConsoleOnLoad; | |
| 5183 | ✗ | zc_set_config("CONSOLE","clear_console_on_load",clearConsoleOnLoad?1:0); | |
| 5184 | ✗ | return D_O_K; | |
| 5185 | } | ||
| 5186 | |||
| 5187 | |||
| 5188 | ✗ | int32_t onFrameSkip() | |
| 5189 | { | ||
| 5190 | ✗ | FrameSkip = !FrameSkip; | |
| 5191 | ✗ | return D_O_K; | |
| 5192 | } | ||
| 5193 | |||
| 5194 | ✗ | int32_t onSaveDragResize() | |
| 5195 | { | ||
| 5196 | ✗ | SaveDragResize = !SaveDragResize; | |
| 5197 | ✗ | zc_set_config(cfg_sect,"save_drag_resize",(int32_t)SaveDragResize); | |
| 5198 | ✗ | return D_O_K; | |
| 5199 | } | ||
| 5200 | |||
| 5201 | ✗ | int32_t onDragAspect() | |
| 5202 | { | ||
| 5203 | ✗ | DragAspect = !DragAspect; | |
| 5204 | ✗ | zc_set_config(cfg_sect,"drag_aspect",(int32_t)DragAspect); | |
| 5205 | ✗ | return D_O_K; | |
| 5206 | } | ||
| 5207 | |||
| 5208 | ✗ | int32_t onTransLayers() | |
| 5209 | { | ||
| 5210 | ✗ | TransLayers = !TransLayers; | |
| 5211 | ✗ | zc_set_config(cfg_sect,"translayers",(int32_t)TransLayers); | |
| 5212 | ✗ | return D_O_K; | |
| 5213 | } | ||
| 5214 | |||
| 5215 | ✗ | int32_t onNESquit() | |
| 5216 | { | ||
| 5217 | ✗ | NESquit = !NESquit; | |
| 5218 | ✗ | zc_set_config(cfg_sect,"fastquit",(int32_t)NESquit); | |
| 5219 | ✗ | return D_O_K; | |
| 5220 | } | ||
| 5221 | |||
| 5222 | ✗ | int32_t onVolKeys() | |
| 5223 | { | ||
| 5224 | ✗ | volkeys = !volkeys; | |
| 5225 | ✗ | zc_set_config(sfx_sect,"volkeys",(int32_t)volkeys); | |
| 5226 | ✗ | return D_O_K; | |
| 5227 | } | ||
| 5228 | |||
| 5229 | ✗ | int32_t onShowFPS() | |
| 5230 | { | ||
| 5231 | ✗ | ShowFPS = !ShowFPS; | |
| 5232 | ✗ | zc_set_config(cfg_sect,"showfps",(int32_t)ShowFPS); | |
| 5233 | ✗ | return D_O_K; | |
| 5234 | } | ||
| 5235 | |||
| 5236 | 1095624572 | bool is_Fkey(int32_t k) | |
| 5237 | { | ||
| 5238 |
2/2✓ Branch 0 taken 111419448 times.
✓ Branch 1 taken 984205124 times.
|
1095624572 | switch(k) |
| 5239 | { | ||
| 5240 | case KEY_F1: | ||
| 5241 | case KEY_F2: | ||
| 5242 | case KEY_F3: | ||
| 5243 | case KEY_F4: | ||
| 5244 | case KEY_F5: | ||
| 5245 | case KEY_F6: | ||
| 5246 | case KEY_F7: | ||
| 5247 | case KEY_F8: | ||
| 5248 | case KEY_F9: | ||
| 5249 | case KEY_F10: | ||
| 5250 | case KEY_F11: | ||
| 5251 | case KEY_F12: | ||
| 5252 | 111419448 | return true; | |
| 5253 | } | ||
| 5254 | |||
| 5255 | 984205124 | return false; | |
| 5256 | 1095624572 | } | |
| 5257 | |||
| 5258 | void kb_getkey(DIALOG *d); | ||
| 5259 | |||
| 5260 | //Used by all keyboard key settings dialogues. | ||
| 5261 | ✗ | void kb_clearjoystick(DIALOG *d) | |
| 5262 | { | ||
| 5263 | ✗ | d->flags|=D_SELECTED; | |
| 5264 | |||
| 5265 | ✗ | jwin_button_proc(MSG_DRAW,d,0); | |
| 5266 | ✗ | jwin_draw_win(gui_bmp, (gui_bmp->w-160)/2, (gui_bmp->h-48)/2, 168, 48, FR_WIN); | |
| 5267 | // text_mode(vc(11)); | ||
| 5268 | ✗ | textout_centre_ex(gui_bmp, font, "Press any key to clear", gui_bmp->w/2, gui_bmp->h/2 - 8, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5269 | ✗ | textout_centre_ex(gui_bmp, font, "ESC to cancel", gui_bmp->w/2, gui_bmp->h/2, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5270 | |||
| 5271 | ✗ | update_hw_screen(true); | |
| 5272 | |||
| 5273 | ✗ | clear_keybuf(); | |
| 5274 | ✗ | int32_t k = next_press_key(); | |
| 5275 | ✗ | clear_keybuf(); | |
| 5276 | |||
| 5277 | //shnarf | ||
| 5278 | //47=f1 | ||
| 5279 | //59=esc | ||
| 5280 | // if(k>0 && k<123 && !((k>46)&&(k<60))) | ||
| 5281 | // *((int32_t*)d->dp3) = k; | ||
| 5282 | ✗ | if ( k != 59 ) *((int32_t*)d->dp3) = 0; | |
| 5283 | |||
| 5284 | |||
| 5285 | ✗ | d->flags&=~D_SELECTED; | |
| 5286 | ✗ | } | |
| 5287 | |||
| 5288 | //Clears key to 0. | ||
| 5289 | //Used by all keyboard key settings dialogues. | ||
| 5290 | void kb_clearkey(DIALOG *d); | ||
| 5291 | |||
| 5292 | ✗ | int32_t d_j_clearbutton_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 5293 | { | ||
| 5294 | ✗ | switch(msg) | |
| 5295 | { | ||
| 5296 | case MSG_KEY: | ||
| 5297 | case MSG_CLICK: | ||
| 5298 | |||
| 5299 | ✗ | kb_clearjoystick(d); | |
| 5300 | |||
| 5301 | ✗ | while(gui_mouse_b()) | |
| 5302 | { | ||
| 5303 | ✗ | clear_keybuf(); | |
| 5304 | ✗ | rest(1); | |
| 5305 | } | ||
| 5306 | |||
| 5307 | ✗ | return D_REDRAW; | |
| 5308 | } | ||
| 5309 | |||
| 5310 | ✗ | return jwin_button_proc(msg,d,c); | |
| 5311 | ✗ | } | |
| 5312 | |||
| 5313 | int32_t d_kbutton_proc(int32_t msg,DIALOG *d,int32_t c); | ||
| 5314 | //Only used in keyboard settings dialogues to clear keys. | ||
| 5315 | int32_t d_k_clearbutton_proc(int32_t msg,DIALOG *d,int32_t c); | ||
| 5316 | |||
| 5317 | ✗ | void j_getbtn(DIALOG *d) | |
| 5318 | { | ||
| 5319 | ✗ | d->flags|=D_SELECTED; | |
| 5320 | ✗ | jwin_button_proc(MSG_DRAW,d,0); | |
| 5321 | ✗ | jwin_draw_win(gui_bmp, (gui_bmp->w-160)/2, (gui_bmp->h-48)/2, 160, 48, FR_WIN); | |
| 5322 | // text_mode(vc(11)); | ||
| 5323 | ✗ | int32_t y = gui_bmp->h/2 - 12; | |
| 5324 | ✗ | textout_centre_ex(gui_bmp, font, "Press a button", gui_bmp->w/2, y, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5325 | ✗ | textout_centre_ex(gui_bmp, font, "ESC to cancel", gui_bmp->w/2, y+8, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5326 | ✗ | textout_centre_ex(gui_bmp, font, "SPACE to disable", gui_bmp->w/2, y+16, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5327 | |||
| 5328 | ✗ | update_hw_screen(true); | |
| 5329 | |||
| 5330 | ✗ | int32_t b = next_press_btn(); | |
| 5331 | |||
| 5332 | ✗ | if(b>=0) | |
| 5333 | ✗ | *((int32_t*)d->dp3) = b; | |
| 5334 | |||
| 5335 | ✗ | d->flags&=~D_SELECTED; | |
| 5336 | |||
| 5337 | ✗ | if (player) | |
| 5338 | ✗ | player->joy_on = TRUE; | |
| 5339 | ✗ | } | |
| 5340 | |||
| 5341 | ✗ | int32_t d_jbutton_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 5342 | { | ||
| 5343 | ✗ | switch(msg) | |
| 5344 | { | ||
| 5345 | case MSG_KEY: | ||
| 5346 | case MSG_CLICK: | ||
| 5347 | |||
| 5348 | ✗ | j_getbtn(d); | |
| 5349 | |||
| 5350 | ✗ | while(gui_mouse_b()) { | |
| 5351 | ✗ | rest(1); | |
| 5352 | ✗ | clear_keybuf(); | |
| 5353 | } | ||
| 5354 | |||
| 5355 | ✗ | return D_REDRAW; | |
| 5356 | } | ||
| 5357 | |||
| 5358 | ✗ | return jwin_button_proc(msg,d,c); | |
| 5359 | ✗ | } | |
| 5360 | |||
| 5361 | //shnarf | ||
| 5362 | extern const char *key_str[]; | ||
| 5363 | std::string get_keystr(int key); | ||
| 5364 | |||
| 5365 | const char *pan_str[4] = { "MONO", " 1/2", " 3/4", "FULL" }; | ||
| 5366 | //extern int32_t zcmusic_bufsz; | ||
| 5367 | |||
| 5368 | static char str_a[80],str_b[80],str_s[80],str_m[80],str_l[80],str_r[80],str_p[80],str_ex1[80],str_ex2[80],str_ex3[80],str_ex4[80], | ||
| 5369 | str_leftmod1[80],str_leftmod2[80],str_rightmod1[80],str_rightmod2[80], str_left[80], str_right[80], str_up[80], str_down[80]; | ||
| 5370 | |||
| 5371 | ✗ | int32_t d_stringloader(int32_t msg,DIALOG *d,int32_t c) | |
| 5372 | { | ||
| 5373 | //these are here to bypass compiler warnings about unused arguments | ||
| 5374 | ✗ | c=c; | |
| 5375 | |||
| 5376 | ✗ | if(msg==MSG_DRAW) | |
| 5377 | { | ||
| 5378 | ✗ | switch(d->w) | |
| 5379 | { | ||
| 5380 | case 0: | ||
| 5381 | ✗ | sprintf(str_a,"%03d\n%s",Akey,key_str[Akey]); | |
| 5382 | ✗ | sprintf(str_b,"%03d\n%s",Bkey,key_str[Bkey]); | |
| 5383 | ✗ | sprintf(str_s,"%03d\n%s",Skey,key_str[Skey]); | |
| 5384 | ✗ | sprintf(str_l,"%03d\n%s",Lkey,key_str[Lkey]); | |
| 5385 | ✗ | sprintf(str_r,"%03d\n%s",Rkey,key_str[Rkey]); | |
| 5386 | ✗ | sprintf(str_p,"%03d\n%s",Pkey,key_str[Pkey]); | |
| 5387 | ✗ | sprintf(str_ex1,"%03d\n%s",Exkey1,key_str[Exkey1]); | |
| 5388 | ✗ | sprintf(str_ex2,"%03d\n%s",Exkey2,key_str[Exkey2]); | |
| 5389 | ✗ | sprintf(str_ex3,"%03d\n%s",Exkey3,key_str[Exkey3]); | |
| 5390 | ✗ | sprintf(str_ex4,"%03d\n%s",Exkey4,key_str[Exkey4]); | |
| 5391 | ✗ | sprintf(str_up,"%03d\n%s",DUkey,key_str[DUkey]); | |
| 5392 | ✗ | sprintf(str_down,"%03d\n%s",DDkey,key_str[DDkey]); | |
| 5393 | ✗ | sprintf(str_left,"%03d\n%s",DLkey,key_str[DLkey]); | |
| 5394 | ✗ | sprintf(str_right,"%03d\n%s",DRkey,key_str[DRkey]); | |
| 5395 | ✗ | sprintf(str_leftmod1,"%03d\n%s",cheat_modifier_keys[0],key_str[cheat_modifier_keys[0]]); | |
| 5396 | ✗ | sprintf(str_leftmod2,"%03d\n%s",cheat_modifier_keys[1],key_str[cheat_modifier_keys[1]]); | |
| 5397 | ✗ | sprintf(str_rightmod1,"%03d\n%s",cheat_modifier_keys[2],key_str[cheat_modifier_keys[2]]); | |
| 5398 | ✗ | sprintf(str_rightmod2,"%03d\n%s",cheat_modifier_keys[3],key_str[cheat_modifier_keys[3]]); | |
| 5399 | ✗ | break; | |
| 5400 | |||
| 5401 | case 1: | ||
| 5402 | ✗ | sprintf(str_a,"%03d\n%s",Abtn,joybtn_name(Abtn)); | |
| 5403 | ✗ | sprintf(str_b,"%03d\n%s",Bbtn,joybtn_name(Bbtn)); | |
| 5404 | ✗ | sprintf(str_s,"%03d\n%s",Sbtn,joybtn_name(Sbtn)); | |
| 5405 | ✗ | sprintf(str_l,"%03d\n%s",Lbtn,joybtn_name(Lbtn)); | |
| 5406 | ✗ | sprintf(str_r,"%03d\n%s",Rbtn,joybtn_name(Rbtn)); | |
| 5407 | ✗ | sprintf(str_m,"%03d\n%s",Mbtn,joybtn_name(Mbtn)); | |
| 5408 | ✗ | sprintf(str_p,"%03d\n%s",Pbtn,joybtn_name(Pbtn)); | |
| 5409 | ✗ | sprintf(str_ex1,"%03d\n%s",Exbtn1,joybtn_name(Exbtn1)); | |
| 5410 | ✗ | sprintf(str_ex2,"%03d\n%s",Exbtn2,joybtn_name(Exbtn2)); | |
| 5411 | ✗ | sprintf(str_ex3,"%03d\n%s",Exbtn3,joybtn_name(Exbtn3)); | |
| 5412 | ✗ | sprintf(str_ex4,"%03d\n%s",Exbtn4,joybtn_name(Exbtn4)); | |
| 5413 | ✗ | sprintf(str_up,"%03d\n%s",DUbtn,joybtn_name(DUbtn)); | |
| 5414 | ✗ | sprintf(str_down,"%03d\n%s",DDbtn,joybtn_name(DDbtn)); | |
| 5415 | ✗ | sprintf(str_left,"%03d\n%s",DLbtn,joybtn_name(DLbtn)); | |
| 5416 | ✗ | sprintf(str_right,"%03d\n%s",DRbtn,joybtn_name(DRbtn)); | |
| 5417 | ✗ | sprintf(str_leftmod1,"%03d\n%s",cheat_modifier_keys[0],key_str[cheat_modifier_keys[0]]); | |
| 5418 | ✗ | sprintf(str_leftmod2,"%03d\n%s",cheat_modifier_keys[1],key_str[cheat_modifier_keys[1]]); | |
| 5419 | ✗ | sprintf(str_rightmod1,"%03d\n%s",cheat_modifier_keys[2],key_str[cheat_modifier_keys[2]]); | |
| 5420 | ✗ | sprintf(str_rightmod2,"%03d\n%s",cheat_modifier_keys[3],key_str[cheat_modifier_keys[3]]); | |
| 5421 | ✗ | break; | |
| 5422 | |||
| 5423 | case 2: | ||
| 5424 | ✗ | sprintf(str_a," %3d",midi_volume); | |
| 5425 | ✗ | sprintf(str_b," %3d",digi_volume); | |
| 5426 | ✗ | sprintf(str_l," %3d",emusic_volume); | |
| 5427 | ✗ | sprintf(str_m," %3dKB",zcmusic_bufsz); | |
| 5428 | ✗ | sprintf(str_r," %3d",sfx_volume); | |
| 5429 | ✗ | strcpy(str_s,pan_str[pan_style]); | |
| 5430 | ✗ | sprintf(str_leftmod1,"%3d\n%s",cheat_modifier_keys[0],key_str[cheat_modifier_keys[0]]); | |
| 5431 | ✗ | sprintf(str_leftmod2,"%3d\n%s",cheat_modifier_keys[1],key_str[cheat_modifier_keys[1]]); | |
| 5432 | ✗ | sprintf(str_rightmod1,"%3d\n%s",cheat_modifier_keys[2],key_str[cheat_modifier_keys[2]]); | |
| 5433 | ✗ | sprintf(str_rightmod2,"%3d\n%s",cheat_modifier_keys[3],key_str[cheat_modifier_keys[3]]); | |
| 5434 | ✗ | break; | |
| 5435 | } | ||
| 5436 | ✗ | } | |
| 5437 | |||
| 5438 | ✗ | return D_O_K; | |
| 5439 | } | ||
| 5440 | |||
| 5441 | ✗ | int32_t set_vol(void *dp3, int32_t d2) | |
| 5442 | { | ||
| 5443 | ✗ | switch(((int32_t*)dp3)[0]) | |
| 5444 | { | ||
| 5445 | case 0: | ||
| 5446 | ✗ | midi_volume = zc_min(d2<<3,255); | |
| 5447 | ✗ | break; | |
| 5448 | |||
| 5449 | case 1: | ||
| 5450 | ✗ | digi_volume = zc_min(d2<<3,255); | |
| 5451 | ✗ | break; | |
| 5452 | |||
| 5453 | case 2: | ||
| 5454 | ✗ | emusic_volume = zc_min(d2<<3,255); | |
| 5455 | ✗ | break; | |
| 5456 | |||
| 5457 | case 3: | ||
| 5458 | ✗ | sfx_volume = zc_min(d2<<3,255); | |
| 5459 | ✗ | break; | |
| 5460 | } | ||
| 5461 | |||
| 5462 | // text_mode(vc(11)); | ||
| 5463 | ✗ | textprintf_right_ex(screen,get_zc_font(font_lfont_l), ((int32_t*)dp3)[1],((int32_t*)dp3)[2],jwin_pal[jcBOXFG],jwin_pal[jcBOX],"%3d",zc_min(d2<<3,255)); | |
| 5464 | ✗ | return D_O_K; | |
| 5465 | } | ||
| 5466 | |||
| 5467 | ✗ | int32_t set_pan(void *dp3, int32_t d2) | |
| 5468 | { | ||
| 5469 | ✗ | pan_style = vbound(d2,0,3); | |
| 5470 | // text_mode(vc(11)); | ||
| 5471 | ✗ | textout_right_ex(screen,get_zc_font(font_lfont_l), pan_str[pan_style],((int32_t*)dp3)[1],((int32_t*)dp3)[2],jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5472 | ✗ | return D_O_K; | |
| 5473 | } | ||
| 5474 | |||
| 5475 | ✗ | int32_t set_buf(void *dp3, int32_t d2) | |
| 5476 | { | ||
| 5477 | // text_mode(vc(11)); | ||
| 5478 | ✗ | zcmusic_bufsz = d2 + 1; | |
| 5479 | ✗ | textprintf_right_ex(screen,get_zc_font(font_lfont_l), ((int32_t*)dp3)[1],((int32_t*)dp3)[2],jwin_pal[jcBOXFG],jwin_pal[jcBOX],"%3dKB",zcmusic_bufsz); | |
| 5480 | ✗ | return D_O_K; | |
| 5481 | } | ||
| 5482 | |||
| 5483 | static int32_t gamepad_btn_list[] = | ||
| 5484 | { | ||
| 5485 | 6, | ||
| 5486 | 7,8,9,10,11,12,13,14,15,16,17, | ||
| 5487 | 18,19,20,21,22,23,24,25,26,27,28, | ||
| 5488 | 29,30,31,32,33,34,35,36,37,38,39, | ||
| 5489 | -1 | ||
| 5490 | }; | ||
| 5491 | |||
| 5492 | static int32_t gamepad_dirs_list[] = | ||
| 5493 | { | ||
| 5494 | 40,41,42,43, | ||
| 5495 | 44,45,46,47, | ||
| 5496 | 48,49,50,51, | ||
| 5497 | 52,53,54,55, | ||
| 5498 | 56, | ||
| 5499 | -1 | ||
| 5500 | }; | ||
| 5501 | |||
| 5502 | static TABPANEL gamepad_tabs[] = | ||
| 5503 | { | ||
| 5504 | // (text) | ||
| 5505 | { (char *)"Buttons", D_SELECTED, gamepad_btn_list, 0, NULL }, | ||
| 5506 | { (char *)"Directions", 0, gamepad_dirs_list, 0, NULL }, | ||
| 5507 | { NULL, 0, NULL, 0, NULL } | ||
| 5508 | }; | ||
| 5509 | |||
| 5510 | static DIALOG gamepad_dlg[] = | ||
| 5511 | { | ||
| 5512 | // (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) | ||
| 5513 | { jwin_win_proc, 8, 24, 304, 256, 0, 0, 0, D_EXIT, 0, 0, (void *) "Gamepad Controls", NULL, NULL }, | ||
| 5514 | { jwin_tab_proc, 8+4, 24+23,304-8,256-52,vc(0), vc(15), 0, 0, 0, 0, (void *) gamepad_tabs, NULL, (void *)gamepad_dlg }, | ||
| 5515 | { d_stringloader, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5516 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5517 | { jwin_button_proc, 90, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 5518 | { jwin_button_proc, 170, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 5519 | // 6 | ||
| 5520 | { d_dummy_proc, 14, 61, 294, 192, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5521 | // 7 | ||
| 5522 | { jwin_ctext_proc, 92, 92-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_a, NULL, NULL }, | ||
| 5523 | { jwin_ctext_proc, 92, 120-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_b, NULL, NULL }, | ||
| 5524 | { jwin_ctext_proc, 92, 148-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5525 | { jwin_ctext_proc, 92, 180-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex1, NULL, NULL }, | ||
| 5526 | { jwin_ctext_proc, 92, 212-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex3, NULL, NULL }, | ||
| 5527 | { jwin_ctext_proc, 237, 92-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_l, NULL, NULL }, | ||
| 5528 | { jwin_ctext_proc, 237, 120-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_r, NULL, NULL }, | ||
| 5529 | { jwin_ctext_proc, 237, 148-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_p, NULL, NULL }, | ||
| 5530 | { jwin_ctext_proc, 237, 180-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex2, NULL, NULL }, | ||
| 5531 | { jwin_ctext_proc, 237, 212-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex4, NULL, NULL }, | ||
| 5532 | { jwin_ctext_proc, 92, 244-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_m, NULL, NULL }, | ||
| 5533 | // 18 | ||
| 5534 | { d_jbutton_proc, 22, 90-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "A", NULL, &Abtn}, | ||
| 5535 | { d_jbutton_proc, 22, 118-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "B", NULL, &Bbtn}, | ||
| 5536 | { d_jbutton_proc, 22, 146-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Start", NULL, &Sbtn}, | ||
| 5537 | { d_jbutton_proc, 22, 178-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "X (EX1)", NULL, &Exbtn1}, | ||
| 5538 | { d_jbutton_proc, 22, 210-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX3", NULL, &Exbtn3}, | ||
| 5539 | { d_jbutton_proc, 167, 90-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "L", NULL, &Lbtn}, | ||
| 5540 | { d_jbutton_proc, 167, 118-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "R", NULL, &Rbtn}, | ||
| 5541 | { d_jbutton_proc, 167, 146-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Map", NULL, &Pbtn}, | ||
| 5542 | { d_jbutton_proc, 167, 178-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Y (EX2)", NULL, &Exbtn2}, | ||
| 5543 | { d_jbutton_proc, 167, 210-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX4", NULL, &Exbtn4}, | ||
| 5544 | { d_jbutton_proc, 22, 242-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Menu", NULL, &Mbtn}, | ||
| 5545 | // 29 | ||
| 5546 | { d_j_clearbutton_proc, 22+91, 90-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Abtn}, | ||
| 5547 | { d_j_clearbutton_proc, 22+91, 118-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Bbtn}, | ||
| 5548 | { d_j_clearbutton_proc, 22+91, 146-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Sbtn}, | ||
| 5549 | { d_j_clearbutton_proc, 22+91, 178-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn1}, | ||
| 5550 | { d_j_clearbutton_proc, 22+91, 210-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn3}, | ||
| 5551 | { d_j_clearbutton_proc, 167+91, 90-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Lbtn}, | ||
| 5552 | { d_j_clearbutton_proc, 167+91, 118-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Rbtn}, | ||
| 5553 | { d_j_clearbutton_proc, 167+91, 146-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Pbtn}, | ||
| 5554 | { d_j_clearbutton_proc, 167+91, 178-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn2}, | ||
| 5555 | { d_j_clearbutton_proc, 167+91, 210-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn4}, | ||
| 5556 | { d_j_clearbutton_proc, 22+91, 242-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Mbtn}, | ||
| 5557 | // 40 | ||
| 5558 | { jwin_frame_proc, 14, 62, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5559 | { jwin_frame_proc, 159, 62, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5560 | { jwin_text_proc, 30, 68, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Vertical", NULL, NULL }, | ||
| 5561 | { jwin_text_proc, 175, 68, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Horizontal", NULL, NULL }, | ||
| 5562 | // 44 | ||
| 5563 | { jwin_text_proc, 92, 84, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_up, NULL, NULL }, | ||
| 5564 | { jwin_text_proc, 92, 112, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_down, NULL, NULL }, | ||
| 5565 | { jwin_text_proc, 237, 84, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_left, NULL, NULL }, | ||
| 5566 | { jwin_text_proc, 237, 112, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_right, NULL, NULL }, | ||
| 5567 | // 48 | ||
| 5568 | { d_jbutton_proc, 22, 82, 61, 21, vc(14), vc(11), 0, 0, 0, 0, (void *) "Up", NULL, &DUbtn }, | ||
| 5569 | { d_jbutton_proc, 22, 110, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Down", NULL, &DDbtn }, | ||
| 5570 | { d_jbutton_proc, 167, 82, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Left", NULL, &DLbtn }, | ||
| 5571 | { d_jbutton_proc, 167, 110, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Right", NULL, &DRbtn }, | ||
| 5572 | // 52 | ||
| 5573 | { d_j_clearbutton_proc, 22+91, 82, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DUbtn}, | ||
| 5574 | { d_j_clearbutton_proc, 22+91, 110, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DDbtn}, | ||
| 5575 | { d_j_clearbutton_proc, 167+91, 82, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DLbtn}, | ||
| 5576 | { d_j_clearbutton_proc, 167+91, 110, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DRbtn}, | ||
| 5577 | // 56 | ||
| 5578 | { jwin_check_proc, 22, 150, 147, 8, vc(14), vc(1), 0, 0, 1, 0, (void *) "Use Analog Stick/DPad", NULL, NULL }, | ||
| 5579 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5580 | }; | ||
| 5581 | |||
| 5582 | static int32_t keyboard_keys_list[] = | ||
| 5583 | { | ||
| 5584 | 6,7,8,9,10, | ||
| 5585 | 11,12,13,14,15,16,17,18,19,20, | ||
| 5586 | 21,22,23,24,25,26,27,28,29,30, | ||
| 5587 | 31,32,33,34,35,36,37,38,39,40, | ||
| 5588 | -1 | ||
| 5589 | }; | ||
| 5590 | |||
| 5591 | static int32_t keyboard_dirs_list[] = | ||
| 5592 | { | ||
| 5593 | 41,42,43,44, | ||
| 5594 | 45,46,47,48, | ||
| 5595 | 49,50,51,52, | ||
| 5596 | 53,54,55,56, | ||
| 5597 | -1 | ||
| 5598 | }; | ||
| 5599 | |||
| 5600 | static int32_t keyboard_mods_list[] = | ||
| 5601 | { | ||
| 5602 | 57,58,59,60, | ||
| 5603 | 61,62,63,64, | ||
| 5604 | 65,66,67,68, | ||
| 5605 | 69,70,71,72, | ||
| 5606 | -1 | ||
| 5607 | }; | ||
| 5608 | |||
| 5609 | static TABPANEL keyboard_control_tabs[] = | ||
| 5610 | { | ||
| 5611 | // (text) | ||
| 5612 | { (char *)"Keys", D_SELECTED, keyboard_keys_list, 0, NULL }, | ||
| 5613 | { (char *)"Directions", 0, keyboard_dirs_list, 0, NULL }, | ||
| 5614 | { (char *)"Cheat Mods", 0, keyboard_mods_list, 0, NULL }, | ||
| 5615 | { NULL, 0, NULL, 0, NULL } | ||
| 5616 | }; | ||
| 5617 | |||
| 5618 | static DIALOG keyboard_control_dlg[] = | ||
| 5619 | { | ||
| 5620 | // (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) | ||
| 5621 | { jwin_win_proc, 8, 39, 304, 240, 0, 0, 0, D_EXIT, 0, 0, (void *) "Keyboard Controls", NULL, NULL }, | ||
| 5622 | { jwin_tab_proc, 8+4, 39+23,304-8,240-56,vc(0), vc(15), 0, 0, 0, 0, (void *) keyboard_control_tabs, NULL, (void *)keyboard_control_dlg }, | ||
| 5623 | { d_stringloader, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5624 | { jwin_button_proc, 90, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 5625 | { jwin_button_proc, 170, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 5626 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5627 | // Keys | ||
| 5628 | // 6 | ||
| 5629 | { jwin_frame_proc, 14, 80, 148, 105, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5630 | { jwin_frame_proc, 158, 80, 148, 105, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5631 | { jwin_frame_proc, 14, 181, 292, 67, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5632 | { jwin_text_proc, 30, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Standard", NULL, NULL }, | ||
| 5633 | { jwin_text_proc, 175, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Extended", NULL, NULL }, | ||
| 5634 | // 11 | ||
| 5635 | { jwin_text_proc, 92-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_a, NULL, NULL }, | ||
| 5636 | { jwin_text_proc, 92-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_b, NULL, NULL }, | ||
| 5637 | { jwin_text_proc, 92-4, 158, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5638 | { jwin_text_proc, 92-4, 190, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex1, NULL, NULL }, | ||
| 5639 | { jwin_text_proc, 92-4, 222, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex3, NULL, NULL }, | ||
| 5640 | { jwin_text_proc, 237-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_l, NULL, NULL }, | ||
| 5641 | { jwin_text_proc, 237-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_r, NULL, NULL }, | ||
| 5642 | { jwin_text_proc, 237-4, 158, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_p, NULL, NULL }, | ||
| 5643 | { jwin_text_proc, 237-4, 190, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex2, NULL, NULL }, | ||
| 5644 | { jwin_text_proc, 237-4, 222, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex4, NULL, NULL }, | ||
| 5645 | // 21 | ||
| 5646 | { d_kbutton_proc, 22, 100, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "A", NULL, &Akey}, | ||
| 5647 | { d_kbutton_proc, 22, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "B", NULL, &Bkey}, | ||
| 5648 | { d_kbutton_proc, 22, 156, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Start", NULL, &Skey}, | ||
| 5649 | { d_kbutton_proc, 22, 188, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "X (EX1)", NULL, &Exkey1}, | ||
| 5650 | { d_kbutton_proc, 22, 220, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX3", NULL, &Exkey3}, | ||
| 5651 | { d_kbutton_proc, 167, 100, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "L", NULL, &Lkey}, | ||
| 5652 | { d_kbutton_proc, 167, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "R", NULL, &Rkey}, | ||
| 5653 | { d_kbutton_proc, 167, 156, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Map", NULL, &Pkey}, | ||
| 5654 | { d_kbutton_proc, 167, 188, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Y (EX2)", NULL, &Exkey2}, | ||
| 5655 | { d_kbutton_proc, 167, 220, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX4", NULL, &Exkey4}, | ||
| 5656 | // 31 | ||
| 5657 | { d_k_clearbutton_proc, 22+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Akey}, | ||
| 5658 | { d_k_clearbutton_proc, 22+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Bkey}, | ||
| 5659 | { d_k_clearbutton_proc, 22+91, 156, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Skey}, | ||
| 5660 | { d_k_clearbutton_proc, 22+91, 188, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey1}, | ||
| 5661 | { d_k_clearbutton_proc, 22+91, 220, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey3}, | ||
| 5662 | { d_k_clearbutton_proc, 167+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Lkey}, | ||
| 5663 | { d_k_clearbutton_proc, 167+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Rkey}, | ||
| 5664 | { d_k_clearbutton_proc, 167+91, 156, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Pkey}, | ||
| 5665 | { d_k_clearbutton_proc, 167+91, 188, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey2}, | ||
| 5666 | { d_k_clearbutton_proc, 167+91, 220, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey4}, | ||
| 5667 | // Dirs | ||
| 5668 | // 41 | ||
| 5669 | { jwin_frame_proc, 14, 80, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5670 | { jwin_frame_proc, 159, 80, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5671 | { jwin_text_proc, 30, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Vertical", NULL, NULL }, | ||
| 5672 | { jwin_text_proc, 175, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Horizontal", NULL, NULL }, | ||
| 5673 | // 45 | ||
| 5674 | { jwin_text_proc, 92-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_up, NULL, NULL }, | ||
| 5675 | { jwin_text_proc, 92-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_down, NULL, NULL }, | ||
| 5676 | { jwin_text_proc, 237-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_left, NULL, NULL }, | ||
| 5677 | { jwin_text_proc, 237-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_right, NULL, NULL }, | ||
| 5678 | // 49 | ||
| 5679 | { d_kbutton_proc, 22, 100, 61, 21, vc(14), vc(11), 0, 0, 0, 0, (void *) "Up", NULL, &DUkey}, | ||
| 5680 | { d_kbutton_proc, 22, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Down", NULL, &DDkey}, | ||
| 5681 | { d_kbutton_proc, 167, 100, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Left", NULL, &DLkey}, | ||
| 5682 | { d_kbutton_proc, 167, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Right", NULL, &DRkey}, | ||
| 5683 | // 53 | ||
| 5684 | { d_k_clearbutton_proc, 22+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DUkey}, | ||
| 5685 | { d_k_clearbutton_proc, 22+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DDkey}, | ||
| 5686 | { d_k_clearbutton_proc, 167+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DLkey}, | ||
| 5687 | { d_k_clearbutton_proc, 167+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DRkey}, | ||
| 5688 | // Mods | ||
| 5689 | // 57 | ||
| 5690 | { jwin_frame_proc, 14, 80, 148, 140-58, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5691 | { jwin_frame_proc, 158, 80, 148, 140-58, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5692 | { jwin_text_proc, 30, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Left", NULL, NULL }, | ||
| 5693 | { jwin_text_proc, 175, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Right", NULL, NULL }, | ||
| 5694 | // 61 | ||
| 5695 | { jwin_text_proc, 92-26, 101, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_leftmod1, NULL, NULL }, | ||
| 5696 | { jwin_text_proc, 92-26, 129, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_rightmod1, NULL, NULL }, | ||
| 5697 | { jwin_text_proc, 237-4-22,101, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_leftmod2, NULL, NULL }, | ||
| 5698 | { jwin_text_proc, 237-4-22,129, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_rightmod2, NULL, NULL }, | ||
| 5699 | // 65 | ||
| 5700 | { d_kbutton_proc, 22, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Main", NULL, &cheat_modifier_keys[0]}, | ||
| 5701 | { d_kbutton_proc, 22, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Second", NULL, &cheat_modifier_keys[2]}, | ||
| 5702 | { d_kbutton_proc, 167, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Main", NULL, &cheat_modifier_keys[1]}, | ||
| 5703 | { d_kbutton_proc, 167, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Second", NULL, &cheat_modifier_keys[3]}, | ||
| 5704 | // 69 | ||
| 5705 | { d_k_clearbutton_proc, 22+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[0]}, | ||
| 5706 | { d_k_clearbutton_proc, 22+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[2]}, | ||
| 5707 | { d_k_clearbutton_proc, 167+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[1]}, | ||
| 5708 | { d_k_clearbutton_proc, 167+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[3]}, | ||
| 5709 | // 73 | ||
| 5710 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5711 | }; | ||
| 5712 | |||
| 5713 | /* | ||
| 5714 | int32_t midi_dp[3] = {0,147,104}; | ||
| 5715 | int32_t digi_dp[3] = {1,147,120}; | ||
| 5716 | int32_t pan_dp[3] = {0,147,136}; | ||
| 5717 | int32_t buf_dp[3] = {0,147,152}; | ||
| 5718 | */ | ||
| 5719 | int32_t midi_dp[3] = {0,0,0}; | ||
| 5720 | int32_t digi_dp[3] = {1,0,0}; | ||
| 5721 | int32_t emus_dp[3] = {2,0,0}; | ||
| 5722 | int32_t buf_dp[3] = {0,0,0}; | ||
| 5723 | int32_t sfx_dp[3] = {3,0,0}; | ||
| 5724 | int32_t pan_dp[3] = {0,0,0}; | ||
| 5725 | |||
| 5726 | static DIALOG sound_dlg[] = | ||
| 5727 | { | ||
| 5728 | //(dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) | ||
| 5729 | 46 | { jwin_win_proc, 0, 0, 320, 178, 0, 0, 0, D_EXIT, 0, 0, (void *) "Sound Settings", NULL, NULL }, | |
| 5730 | 46 | { d_stringloader, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5731 | 46 | { jwin_button_proc, 58, 148, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | |
| 5732 | 46 | { jwin_button_proc, 138, 148, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | |
| 5733 | 46 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5734 | 46 | { jwin_frame_proc, 10, 28, 300, 112, 0, 0, 0, 0, FR_ETCHED, 0, NULL, NULL, NULL }, | |
| 5735 | 46 | { jwin_rtext_proc, 190, 40, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_a, NULL, NULL }, | |
| 5736 | 46 | { jwin_rtext_proc, 190, 56, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_b, NULL, NULL }, | |
| 5737 | 46 | { jwin_rtext_proc, 190, 72, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_l, NULL, NULL }, | |
| 5738 | 46 | { jwin_rtext_proc, 190, 88, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_m, NULL, NULL }, | |
| 5739 | // 10 | ||
| 5740 | 46 | { jwin_rtext_proc, 190, 104, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_r, NULL, NULL }, | |
| 5741 | 46 | { jwin_rtext_proc, 190, 120, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_s, NULL, NULL }, | |
| 5742 | 46 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5743 | 46 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5744 | 46 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5745 | 46 | { jwin_slider_proc, 196, 40, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, midi_dp }, | |
| 5746 | 46 | { jwin_slider_proc, 196, 56, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, digi_dp }, | |
| 5747 | 46 | { jwin_slider_proc, 196, 72, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, emus_dp }, | |
| 5748 | 46 | { jwin_slider_proc, 196, 88, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 127, 0, NULL, (void *) set_buf, buf_dp }, | |
| 5749 | 46 | { jwin_slider_proc, 196, 104, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, sfx_dp }, | |
| 5750 | //20 | ||
| 5751 | 46 | { jwin_slider_proc, 196, 120, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 3, 0, NULL, (void *) set_pan, pan_dp }, | |
| 5752 | 46 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5753 | 46 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5754 | 46 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5755 | 46 | { jwin_text_proc, 17, 40, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Master MIDI Volume", NULL, NULL }, | |
| 5756 | 46 | { jwin_text_proc, 17, 56, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Master Digi Volume", NULL, NULL }, | |
| 5757 | 46 | { jwin_text_proc, 17, 72, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Enhanced Music Volume", NULL, NULL }, | |
| 5758 | 46 | { jwin_text_proc, 17, 88, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Enhanced Music Buffer", NULL, NULL }, | |
| 5759 | 46 | { jwin_text_proc, 17, 104, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "SFX Volume", NULL, NULL }, | |
| 5760 | 46 | { jwin_text_proc, 17, 120, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "SFX Pan", NULL, NULL }, | |
| 5761 | //30 | ||
| 5762 | 46 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5763 | 46 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5764 | 46 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5765 | 46 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5766 | }; | ||
| 5767 | |||
| 5768 | char zc_builddate[80]; | ||
| 5769 | char zc_aboutstr[80]; | ||
| 5770 | |||
| 5771 | static DIALOG about_dlg[] = | ||
| 5772 | { | ||
| 5773 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 5774 | { jwin_win_proc, 68, 52, 184, 154, 0, 0, 0, D_EXIT, 0, 0, (void *) "About", NULL, NULL }, | ||
| 5775 | { jwin_button_proc, 140, 176, 41, 21, vc(14), 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 5776 | { jwin_ctext_proc, 160, 84, 0, 8, vc(0), vc(11), 0, 0, 0, 0, zc_aboutstr, NULL, NULL }, | ||
| 5777 | { jwin_ctext_proc, 160, 92, 0, 8, vc(0) , vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5778 | { jwin_ctext_proc, 160, 100, 0, 8, vc(0) , vc(11), 0, 0, 0, 0, zc_builddate, NULL, NULL }, | ||
| 5779 | { jwin_text_proc, 88, 124, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Coded by:", NULL, NULL }, | ||
| 5780 | { jwin_text_proc, 88, 132, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) " Phantom Menace", NULL, NULL }, | ||
| 5781 | { jwin_text_proc, 88, 144, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Produced by:", NULL, NULL }, | ||
| 5782 | { jwin_text_proc, 88, 152, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) " Armageddon Games", NULL, NULL }, | ||
| 5783 | { jwin_frame_proc, 80, 117, 160, 50, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5784 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5785 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5786 | }; | ||
| 5787 | |||
| 5788 | |||
| 5789 | static DIALOG quest_dlg[] = | ||
| 5790 | { | ||
| 5791 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 5792 | { jwin_win_proc, 68, 25, 184, 190, 0, 0, 0, D_EXIT, 0, 0, (void *) "Quest Info", NULL, NULL }, | ||
| 5793 | { jwin_edit_proc, 84, 54, 152, 16, 0, 0, 0, D_READONLY, 100, 0, NULL, NULL, NULL }, | ||
| 5794 | { jwin_text_proc, 89, 84, 141, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Number:", NULL, NULL }, | ||
| 5795 | { jwin_text_proc, 152, 84, 24, 8, vc(7), vc(11), 0, 0, 0, 0, str_a, NULL, NULL }, | ||
| 5796 | { jwin_text_proc, 89, 94, 141, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Version:", NULL, NULL }, | ||
| 5797 | { jwin_text_proc, 160, 94, 64, 8, vc(7), vc(11), 0, 0, 0, 0, header_version_nul_term, NULL, NULL }, | ||
| 5798 | { jwin_text_proc, 89, 104, 141, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "ZQ Version:", NULL, NULL }, | ||
| 5799 | { jwin_text_proc, 184, 104, 64, 8, vc(7), vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5800 | { jwin_text_proc, 84, 126, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Title:", NULL, NULL }, | ||
| 5801 | { jwin_textbox_proc, 84, 136, 152, 24, 0, 0, 0, 0, 0, 0, QHeader.title, NULL, NULL }, | ||
| 5802 | { jwin_text_proc, 84, 168, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Author:", NULL, NULL }, | ||
| 5803 | { jwin_textbox_proc, 84, 178, 152, 24, 0, 0, 0, 0, 0, 0, QHeader.author, NULL, NULL }, | ||
| 5804 | { jwin_frame_proc, 84, 79, 152, 38, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5805 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5806 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5807 | }; | ||
| 5808 | |||
| 5809 | static DIALOG triforce_dlg[] = | ||
| 5810 | { | ||
| 5811 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) */ | ||
| 5812 | { jwin_win_proc, 72, 64, 177, 105, vc(14), vc(1), 0, D_EXIT, 0, 0, (void *) "Triforce Pieces", NULL, NULL }, | ||
| 5813 | // 1 | ||
| 5814 | { jwin_check_proc, 129, 94, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "1", NULL, NULL }, | ||
| 5815 | { jwin_check_proc, 129, 104, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "2", NULL, NULL }, | ||
| 5816 | { jwin_check_proc, 129, 114, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "3", NULL, NULL }, | ||
| 5817 | { jwin_check_proc, 129, 124, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "4", NULL, NULL }, | ||
| 5818 | { jwin_check_proc, 172, 94, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "5", NULL, NULL }, | ||
| 5819 | { jwin_check_proc, 172, 104, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "6", NULL, NULL }, | ||
| 5820 | { jwin_check_proc, 172, 114, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "7", NULL, NULL }, | ||
| 5821 | { jwin_check_proc, 172, 124, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "8", NULL, NULL }, | ||
| 5822 | // 9 | ||
| 5823 | { jwin_button_proc, 90, 144, 61, 21, vc(0), vc(11), 'k', D_EXIT, 0, 0, (void *) "O&K", NULL, NULL }, | ||
| 5824 | { jwin_button_proc, 170, 144, 61, 21, vc(0), vc(11), 27, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 5825 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5826 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5827 | }; | ||
| 5828 | |||
| 5829 | ✗ | bool zc_getname(const char *prompt,const char *ext,EXT_LIST *list,const char *def,bool usefilename) | |
| 5830 | { | ||
| 5831 | ✗ | go(); | |
| 5832 | ✗ | int32_t ret=0; | |
| 5833 | ✗ | ret = zc_getname_nogo(prompt,ext,list,def,usefilename); | |
| 5834 | ✗ | comeback(); | |
| 5835 | ✗ | return ret != 0; | |
| 5836 | } | ||
| 5837 | |||
| 5838 | |||
| 5839 | ✗ | bool zc_getname_nogo(const char *prompt,const char *ext,EXT_LIST *list,const char *def,bool usefilename) | |
| 5840 | { | ||
| 5841 | ✗ | if(def!=modulepath) | |
| 5842 | ✗ | strcpy(modulepath,def); | |
| 5843 | |||
| 5844 | ✗ | if(!usefilename) | |
| 5845 | { | ||
| 5846 | ✗ | int32_t i=(int32_t)strlen(modulepath); | |
| 5847 | |||
| 5848 | ✗ | while(i>=0 && modulepath[i]!='\\' && modulepath[i]!='/') | |
| 5849 | ✗ | modulepath[i--]=0; | |
| 5850 | ✗ | } | |
| 5851 | |||
| 5852 | // int32_t ret = file_select_ex(prompt,modulepath,ext,255,-1,-1); | ||
| 5853 | ✗ | int32_t ret=0; | |
| 5854 | ✗ | int32_t sel=0; | |
| 5855 | |||
| 5856 | ✗ | if(list==NULL) | |
| 5857 | { | ||
| 5858 | ✗ | ret = jwin_file_select_ex(prompt,modulepath,ext,2048,-1,-1,get_zc_font(font_lfont)); | |
| 5859 | ✗ | } | |
| 5860 | else | ||
| 5861 | { | ||
| 5862 | ✗ | ret = jwin_file_browse_ex(prompt, modulepath, list, &sel, 2048, -1, -1, get_zc_font(font_lfont)); | |
| 5863 | } | ||
| 5864 | |||
| 5865 | ✗ | return ret!=0; | |
| 5866 | } | ||
| 5867 | |||
| 5868 | //The Dialogue that loads a ZMOD Module File | ||
| 5869 | ✗ | int32_t zc_load_zmod_module_file() | |
| 5870 | { | ||
| 5871 | ✗ | if ( Playing ) | |
| 5872 | { | ||
| 5873 | ✗ | jwin_alert("Error","Cannot change module while playing a quest!",NULL,NULL,"O&K",NULL,'k',0,get_zc_font(font_lfont)); | |
| 5874 | ✗ | return -1; | |
| 5875 | } | ||
| 5876 | ✗ | if(!zc_getname("Load Module (.zmod)","zmod",NULL,modulepath,false)) | |
| 5877 | ✗ | return D_CLOSE; | |
| 5878 | |||
| 5879 | ✗ | FILE *tempmodule = fopen(modulepath,"r"); | |
| 5880 | |||
| 5881 | ✗ | if(tempmodule == NULL) | |
| 5882 | { | ||
| 5883 | ✗ | jwin_alert("Error","Cannot open specified file!",NULL,NULL,"O&K",NULL,'k',0,get_zc_font(font_lfont)); | |
| 5884 | ✗ | return -1; | |
| 5885 | } | ||
| 5886 | |||
| 5887 | |||
| 5888 | //Set the module path: | ||
| 5889 | ✗ | memset(moduledata.module_name, 0, sizeof(moduledata.module_name)); | |
| 5890 | ✗ | strcpy(moduledata.module_name, modulepath); | |
| 5891 | ✗ | al_trace("New Module Path is: %s \n", moduledata.module_name); | |
| 5892 | ✗ | zc_set_config("ZCMODULE","current_module",moduledata.module_name); | |
| 5893 | ✗ | zcm.init(true); //Load the module values. | |
| 5894 | ✗ | moduledata.refresh_title_screen = 1; | |
| 5895 | // refresh_select_screen = 1; | ||
| 5896 | ✗ | build_biic_list(); | |
| 5897 | ✗ | return D_O_K; | |
| 5898 | ✗ | } | |
| 5899 | |||
| 5900 | static DIALOG module_info_dlg[] = | ||
| 5901 | { | ||
| 5902 | // (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) | ||
| 5903 | |||
| 5904 | |||
| 5905 | { jwin_win_proc, 0, 0, 200, 200, vc(14), vc(1), 0, D_EXIT, 0, 0, (void *) "About Current Module", NULL, NULL }, | ||
| 5906 | //1 | ||
| 5907 | { jwin_text_proc, 10, 20, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"Module:", NULL, NULL }, | ||
| 5908 | //2 | ||
| 5909 | { jwin_text_proc, 50, 20, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5910 | { jwin_text_proc, 10, 30, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"Author:", NULL, NULL }, | ||
| 5911 | //4 | ||
| 5912 | { jwin_text_proc, 50, 30, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5913 | { jwin_text_proc, 10, 40, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5914 | { jwin_text_proc, 10, 50, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"Information:", NULL, NULL }, | ||
| 5915 | //7 | ||
| 5916 | |||
| 5917 | { jwin_text_proc, 10, 60, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5918 | { jwin_text_proc, 10, 70, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5919 | { jwin_text_proc, 10, 80, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5920 | { jwin_text_proc, 10, 90, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5921 | { jwin_text_proc, 10, 100, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5922 | { jwin_text_proc, 10, 120, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5923 | { jwin_text_proc, 10, 130, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5924 | { jwin_text_proc, 10, 140, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5925 | { jwin_text_proc, 10, 150, 20, 8, vc(11), vc(1), 0, 0, 0, 0, (void*)"", NULL, NULL }, | ||
| 5926 | |||
| 5927 | { jwin_button_proc, 40, 160, 50, 21, vc(14), vc(1), 13, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 5928 | { jwin_button_proc, 200-40-50, 160, 50, 21, vc(14), vc(1), 27, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 5929 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5930 | }; | ||
| 5931 | |||
| 5932 | ✗ | void about_zcplayer_module(const char *prompt,int32_t initialval) | |
| 5933 | { | ||
| 5934 | |||
| 5935 | ✗ | module_info_dlg[0].dp2 = get_zc_font(font_lfont); | |
| 5936 | ✗ | if ( moduledata.moduletitle[0] != 0 ) | |
| 5937 | ✗ | module_info_dlg[2].dp = (char*)moduledata.moduletitle; | |
| 5938 | |||
| 5939 | ✗ | if ( moduledata.moduleauthor[0] != 0 ) | |
| 5940 | ✗ | module_info_dlg[4].dp = (char*)moduledata.moduleauthor; | |
| 5941 | |||
| 5942 | ✗ | if ( moduledata.moduleinfo0[0] != 0 ) | |
| 5943 | ✗ | module_info_dlg[7].dp = (char*)moduledata.moduleinfo0; | |
| 5944 | ✗ | if ( moduledata.moduleinfo1[0] != 0 ) | |
| 5945 | ✗ | module_info_dlg[8].dp = (char*)moduledata.moduleinfo1; | |
| 5946 | ✗ | if ( moduledata.moduleinfo2[0] != 0 ) | |
| 5947 | ✗ | module_info_dlg[9].dp = (char*)moduledata.moduleinfo2; | |
| 5948 | ✗ | if ( moduledata.moduleinfo3[0] != 0 ) | |
| 5949 | ✗ | module_info_dlg[10].dp = (char*)moduledata.moduleinfo3; | |
| 5950 | ✗ | if ( moduledata.moduleinfo4[0] != 0 ) | |
| 5951 | ✗ | module_info_dlg[11].dp = (char*)moduledata.moduleinfo4; | |
| 5952 | |||
| 5953 | char module_date[255]; | ||
| 5954 | ✗ | memset(module_date, 0, sizeof(module_date)); | |
| 5955 | ✗ | sprintf(module_date,"Build Date: %s %s, %d at @ %d:%d %s", dayextension(moduledata.modday).c_str(), | |
| 5956 | ✗ | (char*)months[moduledata.modmonth], moduledata.modyear, moduledata.modhour, moduledata.modminute, moduledata.moduletimezone); | |
| 5957 | |||
| 5958 | |||
| 5959 | |||
| 5960 | char module_vers[255]; | ||
| 5961 | ✗ | memset(module_vers, 0, sizeof(module_vers)); | |
| 5962 | ✗ | sprintf(module_vers, "Version: %d.%d.%d.%d", moduledata.modver_1, moduledata.modver_2, moduledata.modver_3, moduledata.modver_4); | |
| 5963 | |||
| 5964 | |||
| 5965 | //sprintf(tilecount,"%d",1); | ||
| 5966 | |||
| 5967 | char module_build[255]; | ||
| 5968 | ✗ | memset(module_build, 0, sizeof(module_build)); | |
| 5969 | ✗ | if ( moduledata.modbeta ) | |
| 5970 | ✗ | sprintf(module_build,"Module Build: %d, %s: %d", moduledata.modbuild, (moduledata.modbeta<0) ? "Alpha" : "Beta", moduledata.modbeta ); | |
| 5971 | else | ||
| 5972 | ✗ | sprintf(module_build,"Module Build: %d", moduledata.modbuild); | |
| 5973 | |||
| 5974 | ✗ | module_info_dlg[12].dp = (char*)module_date; | |
| 5975 | ✗ | module_info_dlg[13].dp = (char*)module_vers; | |
| 5976 | ✗ | module_info_dlg[14].dp = (char*)module_build; | |
| 5977 | |||
| 5978 | ✗ | large_dialog(module_info_dlg); | |
| 5979 | |||
| 5980 | ✗ | int32_t ret = zc_popup_dialog(module_info_dlg,-1); | |
| 5981 | ✗ | jwin_center_dialog(module_info_dlg); | |
| 5982 | |||
| 5983 | |||
| 5984 | ✗ | } | |
| 5985 | |||
| 5986 | ✗ | int32_t onAbout_ZCP_Module() | |
| 5987 | { | ||
| 5988 | ✗ | about_zcplayer_module("About Module (.zmod)", 0); | |
| 5989 | ✗ | return D_O_K; | |
| 5990 | } | ||
| 5991 | |||
| 5992 | //New Modules Menu for 2.55+ | ||
| 5993 | static MENU zcmodule_menu[] = | ||
| 5994 | { | ||
| 5995 | { (char *)"&Load Module...", zc_load_zmod_module_file, NULL, 0, NULL }, | ||
| 5996 | { (char *)"&About Module", onAbout_ZCP_Module, NULL, 0, NULL }, | ||
| 5997 | |||
| 5998 | { NULL, NULL, NULL, 0, NULL } | ||
| 5999 | }; | ||
| 6000 | |||
| 6001 | ✗ | int32_t onToggleRecordingNewSaves() | |
| 6002 | { | ||
| 6003 | ✗ | if (zc_get_config("zeldadx", "replay_new_saves", false)) | |
| 6004 | { | ||
| 6005 | ✗ | zc_set_config("zeldadx", "replay_new_saves", false); | |
| 6006 | ✗ | } | |
| 6007 | else | ||
| 6008 | { | ||
| 6009 | ✗ | zc_set_config("zeldadx", "replay_new_saves", true); | |
| 6010 | ✗ | jwin_alert("Recording", "Newly created saves will be recorded and written to a replay file.", | |
| 6011 | ✗ | NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 6012 | } | ||
| 6013 | ✗ | return D_O_K; | |
| 6014 | } | ||
| 6015 | |||
| 6016 | ✗ | int32_t onToggleSnapshotAllFrames() | |
| 6017 | { | ||
| 6018 | ✗ | replay_set_snapshot_all_frames(!replay_is_snapshot_all_frames()); | |
| 6019 | ✗ | return D_O_K; | |
| 6020 | } | ||
| 6021 | |||
| 6022 | ✗ | int32_t onStopReplayOrRecord() | |
| 6023 | { | ||
| 6024 | ✗ | if (replay_is_replaying()) | |
| 6025 | { | ||
| 6026 | ✗ | replay_quit(); | |
| 6027 | ✗ | } | |
| 6028 | ✗ | else if (replay_get_mode() == ReplayMode::Record) | |
| 6029 | { | ||
| 6030 | ✗ | if (!replay_get_meta_bool("test_mode")) | |
| 6031 | { | ||
| 6032 | ✗ | jwin_alert("Recording", "You cannot stop recording a save file.", | |
| 6033 | ✗ | NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 6034 | ✗ | return D_CLOSE; | |
| 6035 | } | ||
| 6036 | |||
| 6037 | ✗ | if (jwin_alert("Stop Recording", | |
| 6038 | "Save replay to disk and stop recording?", | ||
| 6039 | "This will stop the recording.", | ||
| 6040 | NULL, | ||
| 6041 | ✗ | "Yes","No",13,27,get_zc_font(font_lfont)) != 1) | |
| 6042 | ✗ | return D_CLOSE; | |
| 6043 | |||
| 6044 | ✗ | replay_save(); | |
| 6045 | ✗ | replay_stop(); | |
| 6046 | ✗ | } | |
| 6047 | ✗ | return D_O_K; | |
| 6048 | ✗ | } | |
| 6049 | |||
| 6050 | ✗ | static int32_t handle_on_load_replay(ReplayMode mode) | |
| 6051 | { | ||
| 6052 | ✗ | if (Playing) | |
| 6053 | { | ||
| 6054 | ✗ | if (jwin_alert("Replay - Warning!", | |
| 6055 | "Loading a replay will exit the current game.", | ||
| 6056 | "All unsaved progress will be lost.", | ||
| 6057 | "Do you wish to continue?", | ||
| 6058 | ✗ | "Yes","No",13,27,get_zc_font(font_lfont)) != 1) | |
| 6059 | ✗ | return D_CLOSE; | |
| 6060 | ✗ | } | |
| 6061 | |||
| 6062 | ✗ | std::string mode_string = replay_mode_to_string(mode); | |
| 6063 | ✗ | mode_string[0] = std::toupper(mode_string[0]); | |
| 6064 | |||
| 6065 | ✗ | std::string line_1 = "Select a replay file to play back."; | |
| 6066 | ✗ | std::string line_2 = "You won't be able to save, and it won't effect existing saves."; | |
| 6067 | ✗ | std::string line_3 = "You can stop the replay and take over manually any time."; | |
| 6068 | ✗ | if (mode == ReplayMode::Update) | |
| 6069 | { | ||
| 6070 | ✗ | line_1 = "Select a replay file to update."; | |
| 6071 | ✗ | line_2 = "WARNING: be sure to back up the zplay file"; | |
| 6072 | ✗ | line_3 = "and verify that the updated replay works as expected!"; | |
| 6073 | ✗ | } | |
| 6074 | |||
| 6075 | ✗ | if (jwin_alert(mode_string.c_str(), | |
| 6076 | ✗ | line_1.c_str(), | |
| 6077 | ✗ | line_2.c_str(), | |
| 6078 | ✗ | line_3.c_str(), | |
| 6079 | ✗ | "OK","Nevermind",13,27,get_zc_font(font_lfont)) == 1) | |
| 6080 | { | ||
| 6081 | char replay_path[2048]; | ||
| 6082 | ✗ | strcpy(replay_path, "replays/"); | |
| 6083 | ✗ | if (jwin_file_select_ex( | |
| 6084 | ✗ | fmt::format("Load Replay (.{})", REPLAY_EXTENSION).c_str(), | |
| 6085 | ✗ | replay_path, REPLAY_EXTENSION.c_str(), 2048, -1, -1, get_zc_font(font_lfont)) == 0) | |
| 6086 | ✗ | return D_CLOSE; | |
| 6087 | |||
| 6088 | ✗ | replay_quit(); | |
| 6089 | ✗ | load_replay_file_deferred(mode, replay_path); | |
| 6090 | ✗ | Quit = qRESET; | |
| 6091 | ✗ | return D_CLOSE; | |
| 6092 | } | ||
| 6093 | ✗ | return D_O_K; | |
| 6094 | ✗ | } | |
| 6095 | |||
| 6096 | ✗ | int32_t onLoadReplay() | |
| 6097 | { | ||
| 6098 | ✗ | return handle_on_load_replay(ReplayMode::Replay); | |
| 6099 | } | ||
| 6100 | |||
| 6101 | ✗ | int32_t onLoadReplayAssert() | |
| 6102 | { | ||
| 6103 | ✗ | return handle_on_load_replay(ReplayMode::Assert); | |
| 6104 | } | ||
| 6105 | |||
| 6106 | ✗ | int32_t onLoadReplayUpdate() | |
| 6107 | { | ||
| 6108 | ✗ | return handle_on_load_replay(ReplayMode::Update); | |
| 6109 | } | ||
| 6110 | |||
| 6111 | ✗ | int32_t onSaveReplay() | |
| 6112 | { | ||
| 6113 | ✗ | if (replay_get_mode() == ReplayMode::Record) | |
| 6114 | { | ||
| 6115 | ✗ | if (!replay_get_meta_bool("test_mode")) | |
| 6116 | { | ||
| 6117 | ✗ | if (jwin_alert("Save Replay", | |
| 6118 | "This will save a copy of the replay up to this point.", | ||
| 6119 | "The official replay file will be untouched.", | ||
| 6120 | "Do you wish to continue?", | ||
| 6121 | ✗ | "Yes","No",13,27,get_zc_font(font_lfont)) != 1) | |
| 6122 | ✗ | return D_CLOSE; | |
| 6123 | |||
| 6124 | char replay_path[2048]; | ||
| 6125 | ✗ | strcpy(replay_path, replay_get_replay_path().string().c_str()); | |
| 6126 | ✗ | if (jwin_file_select_ex( | |
| 6127 | ✗ | fmt::format("Save Replay (.{})", REPLAY_EXTENSION).c_str(), | |
| 6128 | ✗ | replay_path, REPLAY_EXTENSION.c_str(), 2048, -1, -1, get_zc_font(font_lfont)) == 0) | |
| 6129 | ✗ | return D_CLOSE; | |
| 6130 | |||
| 6131 | ✗ | if (fileexists(replay_path)) | |
| 6132 | { | ||
| 6133 | ✗ | jwin_alert("Save Replay", "You cannot overwrite an existing file.", | |
| 6134 | ✗ | NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 6135 | ✗ | return D_CLOSE; | |
| 6136 | } | ||
| 6137 | |||
| 6138 | ✗ | replay_save(replay_path); | |
| 6139 | ✗ | } | |
| 6140 | else | ||
| 6141 | { | ||
| 6142 | ✗ | replay_save(); | |
| 6143 | } | ||
| 6144 | ✗ | } | |
| 6145 | ✗ | return D_O_K; | |
| 6146 | ✗ | } | |
| 6147 | |||
| 6148 | static MENU replay_menu[] = | ||
| 6149 | { | ||
| 6150 | { (char *)"Record new saves", onToggleRecordingNewSaves, NULL, 0, NULL }, | ||
| 6151 | { (char *)"Stop replay", onStopReplayOrRecord, NULL, 0, NULL }, | ||
| 6152 | { (char *)"Load replay", onLoadReplay, NULL, 0, NULL }, | ||
| 6153 | { (char *)"Load replay (assert)", onLoadReplayAssert, NULL, 0, NULL }, | ||
| 6154 | { (char *)"Load replay (update)", onLoadReplayUpdate, NULL, 0, NULL }, | ||
| 6155 | { (char *)"Save replay", onSaveReplay, NULL, 0, NULL }, | ||
| 6156 | { (char *)"Enable snapshot all frames", onToggleSnapshotAllFrames,NULL, 0, NULL }, | ||
| 6157 | |||
| 6158 | { NULL, NULL, NULL, 0, NULL } | ||
| 6159 | }; | ||
| 6160 | |||
| 6161 | static DIALOG credits_dlg[] = | ||
| 6162 | { | ||
| 6163 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 6164 | { jwin_win_proc, 40, 38, 241, 173, vc(14), vc(1), 0, D_EXIT, 0, 0, (void *) "ZQuest Classic Credits", NULL, NULL }, | ||
| 6165 | { jwin_frame_proc, 47, 65, 227, 115, vc(15), vc(1), 0, 0, FR_DEEP, 0, NULL, NULL, NULL }, | ||
| 6166 | { d_bitmap_proc, 49, 67, 222, 110, vc(15), vc(1), 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6167 | { jwin_button_proc, 140, 184, 41, 21, vc(14), vc(1), 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 6168 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6169 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 6170 | }; | ||
| 6171 | |||
| 6172 | 46 | static ListData dmap_list(dmaplist, &font); | |
| 6173 | |||
| 6174 | static DIALOG goto_dlg[] = | ||
| 6175 | { | ||
| 6176 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 6177 | { jwin_win_proc, 48, 25, 205, 100, 0, 0, 0, D_EXIT, 0, 0, (void *) "Goto Location", NULL, NULL }, | ||
| 6178 | { jwin_button_proc, 90, 176-78, 61, 21, vc(14), 0, 13, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 6179 | { jwin_button_proc, 170, 176-78, 61, 21, vc(14), 0, 27, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 6180 | { jwin_text_proc, 55, 129-75, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "DMap:", NULL, NULL }, | ||
| 6181 | { jwin_droplist_proc, 88, 126-75, 160, 16, 0, 0, 0, 0, 0, 0, (void *) &dmap_list, NULL, NULL }, | ||
| 6182 | { jwin_text_proc, 55, 149-75, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Screen:", NULL, NULL }, | ||
| 6183 | { jwin_edit_proc, 132, 146-75, 91, 16, 0, 0, 0, 0, 2, 0, NULL, NULL, NULL }, | ||
| 6184 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6185 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 6186 | }; | ||
| 6187 | |||
| 6188 | ✗ | int32_t onGoTo() | |
| 6189 | { | ||
| 6190 | ✗ | bool music = false; | |
| 6191 | ✗ | music = music; | |
| 6192 | ✗ | sprintf(cheat_goto_screen_str,"%X",cheat_goto_screen); | |
| 6193 | |||
| 6194 | ✗ | goto_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6195 | ✗ | goto_dlg[4].d2=cheat_goto_dmap; | |
| 6196 | ✗ | goto_dlg[6].dp=cheat_goto_screen_str; | |
| 6197 | |||
| 6198 | ✗ | clear_keybuf(); | |
| 6199 | |||
| 6200 | ✗ | large_dialog(goto_dlg); | |
| 6201 | |||
| 6202 | ✗ | if(zc_popup_dialog(goto_dlg,4)==1) | |
| 6203 | { | ||
| 6204 | // dmap, screen | ||
| 6205 | ✗ | cheats_enqueue(Cheat::GoTo, goto_dlg[4].d2, zc_min(zc_xtoi(cheat_goto_screen_str),0x7F)); | |
| 6206 | ✗ | }; | |
| 6207 | |||
| 6208 | ✗ | return D_O_K; | |
| 6209 | ✗ | } | |
| 6210 | |||
| 6211 | ✗ | int32_t onGoToComplete() | |
| 6212 | { | ||
| 6213 | ✗ | if(!Playing) | |
| 6214 | { | ||
| 6215 | ✗ | return D_O_K; | |
| 6216 | } | ||
| 6217 | |||
| 6218 | ✗ | enter_sys_pal(); | |
| 6219 | ✗ | music_pause(); | |
| 6220 | ✗ | pause_all_sfx(); | |
| 6221 | ✗ | onGoTo(); | |
| 6222 | ✗ | eat_buttons(); | |
| 6223 | |||
| 6224 | ✗ | zc_readrawkey(KEY_ESC); | |
| 6225 | |||
| 6226 | ✗ | exit_sys_pal(); | |
| 6227 | ✗ | music_resume(); | |
| 6228 | ✗ | resume_all_sfx(); | |
| 6229 | ✗ | return D_O_K; | |
| 6230 | ✗ | } | |
| 6231 | |||
| 6232 | ✗ | int32_t onCredits() | |
| 6233 | { | ||
| 6234 | ✗ | go(); | |
| 6235 | |||
| 6236 | ✗ | BITMAP *win = create_bitmap_ex(8,222,110); | |
| 6237 | |||
| 6238 | ✗ | if(!win) | |
| 6239 | ✗ | return D_O_K; | |
| 6240 | |||
| 6241 | ✗ | int32_t c=0; | |
| 6242 | ✗ | int32_t l=0; | |
| 6243 | ✗ | int32_t ol=-1; | |
| 6244 | ✗ | RLE_SPRITE *rle = (RLE_SPRITE*)(datafile[RLE_CREDITS].dat); | |
| 6245 | ✗ | RGB *pal = (RGB*)(datafile[PAL_CREDITS].dat); | |
| 6246 | PALETTE tmppal; | ||
| 6247 | |||
| 6248 | ✗ | rti_gui.transparency_index = 1; | |
| 6249 | |||
| 6250 | ✗ | clear_to_color(win, rti_gui.transparency_index); | |
| 6251 | ✗ | draw_rle_sprite(win,rle,0,0); | |
| 6252 | ✗ | credits_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6253 | ✗ | credits_dlg[1].fg = jwin_pal[jcDISABLED_FG]; | |
| 6254 | ✗ | credits_dlg[2].dp = win; | |
| 6255 | |||
| 6256 | ✗ | zc_set_palette_range(black_palette,0,127,false); | |
| 6257 | |||
| 6258 | ✗ | DIALOG_PLAYER *p = init_dialog(credits_dlg,3); | |
| 6259 | |||
| 6260 | ✗ | BITMAP* old_screen = screen; | |
| 6261 | ✗ | BITMAP* gui_bmp = zc_get_gui_bmp(); | |
| 6262 | ✗ | ASSERT(gui_bmp); | |
| 6263 | ✗ | clear_to_color(gui_bmp, rti_gui.transparency_index); | |
| 6264 | ✗ | screen = gui_bmp; | |
| 6265 | |||
| 6266 | ✗ | while(update_dialog(p)) | |
| 6267 | { | ||
| 6268 | ✗ | throttleFPS(); | |
| 6269 | ✗ | ++c; | |
| 6270 | ✗ | l = zc_max((c>>1)-30,0); | |
| 6271 | |||
| 6272 | ✗ | if(l > rle->h) | |
| 6273 | ✗ | l = c = 0; | |
| 6274 | |||
| 6275 | ✗ | if(l > rle->h - 112) | |
| 6276 | ✗ | l = rle->h - 112; | |
| 6277 | |||
| 6278 | ✗ | clear_bitmap(win); | |
| 6279 | ✗ | draw_rle_sprite(win,rle,0,0-l); | |
| 6280 | |||
| 6281 | ✗ | if(c<=64) | |
| 6282 | ✗ | fade_interpolate(black_palette,pal,tmppal,c,0,127); | |
| 6283 | |||
| 6284 | ✗ | zc_set_palette_range(tmppal,0,127,false); | |
| 6285 | |||
| 6286 | ✗ | if(l!=ol) | |
| 6287 | { | ||
| 6288 | ✗ | d_bitmap_proc(MSG_DRAW,credits_dlg+2,0); | |
| 6289 | ✗ | SCRFIX(); | |
| 6290 | ✗ | ol=l; | |
| 6291 | ✗ | } | |
| 6292 | |||
| 6293 | ✗ | update_hw_screen(); | |
| 6294 | } | ||
| 6295 | |||
| 6296 | ✗ | screen = old_screen; | |
| 6297 | ✗ | system_pal(true); | |
| 6298 | ✗ | sys_mouse(); | |
| 6299 | |||
| 6300 | ✗ | shutdown_dialog(p); | |
| 6301 | ✗ | destroy_bitmap(win); | |
| 6302 | //comeback(); | ||
| 6303 | |||
| 6304 | ✗ | rti_gui.transparency_index = 0; | |
| 6305 | ✗ | clear_to_color(gui_bmp, rti_gui.transparency_index); | |
| 6306 | |||
| 6307 | ✗ | return D_O_K; | |
| 6308 | ✗ | } | |
| 6309 | |||
| 6310 | ✗ | const char *midilist(int32_t index, int32_t *list_size) | |
| 6311 | { | ||
| 6312 | ✗ | if(index<0) | |
| 6313 | { | ||
| 6314 | ✗ | *list_size=0; | |
| 6315 | |||
| 6316 | ✗ | for(int32_t i=0; i<MAXMIDIS; i++) | |
| 6317 | ✗ | if(tunes[i].data) | |
| 6318 | ✗ | ++(*list_size); | |
| 6319 | |||
| 6320 | ✗ | return NULL; | |
| 6321 | } | ||
| 6322 | |||
| 6323 | ✗ | int32_t i=0,m=0; | |
| 6324 | |||
| 6325 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6326 | { | ||
| 6327 | ✗ | if(tunes[i].data) | |
| 6328 | ✗ | ++m; | |
| 6329 | |||
| 6330 | ✗ | ++i; | |
| 6331 | } | ||
| 6332 | |||
| 6333 | ✗ | --i; | |
| 6334 | |||
| 6335 | ✗ | if(i==MAXMIDIS && m<index) | |
| 6336 | ✗ | return "(null)"; | |
| 6337 | |||
| 6338 | ✗ | return tunes[i].title; | |
| 6339 | ✗ | } | |
| 6340 | |||
| 6341 | /* ------- MIDI info stuff -------- */ | ||
| 6342 | |||
| 6343 | char *text; | ||
| 6344 | midi_info *zmi; | ||
| 6345 | bool dialog_running; | ||
| 6346 | bool listening; | ||
| 6347 | |||
| 6348 | void get_info(int32_t index); | ||
| 6349 | |||
| 6350 | ✗ | int32_t d_midilist_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 6351 | { | ||
| 6352 | ✗ | int32_t d2 = d->d2; | |
| 6353 | ✗ | int32_t ret = jwin_droplist_proc(msg,d,c); | |
| 6354 | |||
| 6355 | ✗ | if(d2!=d->d2) | |
| 6356 | { | ||
| 6357 | ✗ | get_info(d->d2); | |
| 6358 | ✗ | } | |
| 6359 | |||
| 6360 | ✗ | return ret; | |
| 6361 | } | ||
| 6362 | |||
| 6363 | ✗ | int32_t d_listen_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 6364 | { | ||
| 6365 | /* 'd->d1' is offset from 'd' in DIALOG array to midilist proc */ | ||
| 6366 | |||
| 6367 | ✗ | int32_t ret = jwin_button_proc(msg,d,c); | |
| 6368 | |||
| 6369 | ✗ | if(ret == D_CLOSE) | |
| 6370 | { | ||
| 6371 | // get current midi index | ||
| 6372 | ✗ | int32_t index = (d+(d->d1))->d2; | |
| 6373 | ✗ | int32_t i=0, m=0; | |
| 6374 | |||
| 6375 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6376 | { | ||
| 6377 | ✗ | if(tunes[i].data) | |
| 6378 | ✗ | ++m; | |
| 6379 | |||
| 6380 | ✗ | ++i; | |
| 6381 | } | ||
| 6382 | |||
| 6383 | ✗ | --i; | |
| 6384 | ✗ | jukebox(i); | |
| 6385 | ✗ | listening = true; | |
| 6386 | ✗ | ret = D_O_K; | |
| 6387 | ✗ | } | |
| 6388 | |||
| 6389 | ✗ | return ret; | |
| 6390 | } | ||
| 6391 | |||
| 6392 | ✗ | int32_t d_savemidi_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 6393 | { | ||
| 6394 | /* 'd->d1' is offset from 'd' in DIALOG array to midilist proc */ | ||
| 6395 | |||
| 6396 | ✗ | int32_t ret = jwin_button_proc(msg,d,c); | |
| 6397 | |||
| 6398 | ✗ | if(ret == D_CLOSE) | |
| 6399 | { | ||
| 6400 | // get current midi index | ||
| 6401 | ✗ | int32_t index = (d+(d->d1))->d2; | |
| 6402 | ✗ | int32_t i=0, m=0; | |
| 6403 | |||
| 6404 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6405 | { | ||
| 6406 | ✗ | if(tunes[i].data) | |
| 6407 | ✗ | ++m; | |
| 6408 | |||
| 6409 | ✗ | ++i; | |
| 6410 | } | ||
| 6411 | |||
| 6412 | ✗ | --i; | |
| 6413 | |||
| 6414 | // get file name | ||
| 6415 | |||
| 6416 | ✗ | int32_t sel=0; | |
| 6417 | //struct ffblk f; | ||
| 6418 | ✗ | char title[40] = "Save MIDI: "; | |
| 6419 | char fname[2048]; | ||
| 6420 | ✗ | memset(fname,0,2048); | |
| 6421 | static EXT_LIST list[] = | ||
| 6422 | { | ||
| 6423 | { (char *)"MIDI files (*.mid)", (char *)"mid" }, | ||
| 6424 | { (char *)"HTML files (*.html, *.html)", (char *)"htm html" }, | ||
| 6425 | { NULL, NULL } | ||
| 6426 | }; | ||
| 6427 | |||
| 6428 | ✗ | strcpy(title+11, tunes[i].title); | |
| 6429 | ✗ | title[39] = '\0'; | |
| 6430 | |||
| 6431 | ✗ | if(jwin_file_browse_ex(title, fname, list, &sel, 2048, -1, -1, get_zc_font(font_lfont))==0) | |
| 6432 | ✗ | goto done; | |
| 6433 | |||
| 6434 | ✗ | if(exists(fname)) | |
| 6435 | { | ||
| 6436 | ✗ | if(jwin_alert(title, fname, "already exists.", "Overwrite it?", "&Yes","&No",'y','n',get_zc_font(font_lfont))==2) | |
| 6437 | ✗ | goto done; | |
| 6438 | ✗ | } | |
| 6439 | |||
| 6440 | // save midi i | ||
| 6441 | |||
| 6442 | ✗ | if(save_midi(fname, (MIDI*)tunes[i].data) != 0) | |
| 6443 | ✗ | jwin_alert(title, "Error saving MIDI to", fname, NULL, "Darn", NULL,13,27,get_zc_font(font_lfont)); | |
| 6444 | |||
| 6445 | done: | ||
| 6446 | ✗ | chop_path(fname); | |
| 6447 | ✗ | ret = D_REDRAW; | |
| 6448 | ✗ | } | |
| 6449 | |||
| 6450 | ✗ | return ret; | |
| 6451 | } | ||
| 6452 | |||
| 6453 | 46 | static ListData midi_list(midilist, &font); | |
| 6454 | |||
| 6455 | static DIALOG midi_dlg[] = | ||
| 6456 | { | ||
| 6457 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 6458 | { jwin_win_proc, 8, 28, 304, 184, 0, 0, 0, D_EXIT, 0, 0, (void *) "MIDI Info", NULL, NULL }, | ||
| 6459 | { jwin_text_proc, 32, 60, 40, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Tune:", NULL, NULL }, | ||
| 6460 | { d_midilist_proc, 80, 56, 192, 16, 0, 0, 0, 0, 0, 0, (void *) &midi_list, NULL, NULL }, | ||
| 6461 | { jwin_textbox_proc, 15, 80, 290, 96, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6462 | { d_listen_proc, 24, 183, 72, 21, 0, 0, 'l', D_EXIT, -2, 0, (void *) "&Listen", NULL, NULL }, | ||
| 6463 | { d_savemidi_proc, 108, 183, 72, 21, 0, 0, 's', D_EXIT, -3, 0, (void *) "&Save", NULL, NULL }, | ||
| 6464 | { jwin_button_proc, 236, 183, 61, 21, 0, 0, 'k', D_EXIT, 0, 0, (void *) "O&K", NULL, NULL }, | ||
| 6465 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6466 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 6467 | }; | ||
| 6468 | |||
| 6469 | ✗ | void get_info(int32_t index) | |
| 6470 | { | ||
| 6471 | ✗ | int32_t i=0, m=0; | |
| 6472 | |||
| 6473 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6474 | { | ||
| 6475 | ✗ | if(tunes[i].data) | |
| 6476 | ✗ | ++m; | |
| 6477 | |||
| 6478 | ✗ | ++i; | |
| 6479 | } | ||
| 6480 | |||
| 6481 | ✗ | --i; | |
| 6482 | |||
| 6483 | ✗ | if(i==MAXMIDIS && m<index) | |
| 6484 | ✗ | strcpy(text,"(null)"); | |
| 6485 | else | ||
| 6486 | { | ||
| 6487 | ✗ | get_midi_info((MIDI*)tunes[i].data,zmi); | |
| 6488 | ✗ | get_midi_text((MIDI*)tunes[i].data,zmi,text); | |
| 6489 | } | ||
| 6490 | |||
| 6491 | ✗ | midi_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6492 | ✗ | midi_dlg[3].dp = text; | |
| 6493 | ✗ | midi_dlg[3].d1 = midi_dlg[3].d2 = 0; | |
| 6494 | ✗ | midi_dlg[5].flags = (tunes[i].flags&tfDISABLESAVE) ? D_DISABLED : D_EXIT; | |
| 6495 | |||
| 6496 | ✗ | if(dialog_running) | |
| 6497 | { | ||
| 6498 | ✗ | jwin_textbox_proc(MSG_DRAW,midi_dlg+3,0); | |
| 6499 | ✗ | d_savemidi_proc(MSG_DRAW,midi_dlg+5,0); | |
| 6500 | ✗ | } | |
| 6501 | ✗ | } | |
| 6502 | |||
| 6503 | ✗ | int32_t onMIDICredits() | |
| 6504 | { | ||
| 6505 | ✗ | text = (char*)malloc(4096); | |
| 6506 | ✗ | zmi = (midi_info*)malloc(sizeof(midi_info)); | |
| 6507 | |||
| 6508 | ✗ | if(!text || !zmi) | |
| 6509 | { | ||
| 6510 | ✗ | jwin_alert(NULL,"Not enough memory",NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 6511 | ✗ | return D_O_K; | |
| 6512 | } | ||
| 6513 | |||
| 6514 | ✗ | bool do_pause_midi = midi_pos >= 0 && currmidi; | |
| 6515 | ✗ | auto restore_midi = currmidi; | |
| 6516 | ✗ | if(do_pause_midi) | |
| 6517 | { | ||
| 6518 | ✗ | paused_midi_pos = midi_pos; | |
| 6519 | ✗ | stop_midi(); | |
| 6520 | ✗ | midi_suspended = midissuspHALTED; | |
| 6521 | ✗ | } | |
| 6522 | |||
| 6523 | ✗ | midi_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6524 | ✗ | midi_dlg[2].d1 = 0; | |
| 6525 | ✗ | midi_dlg[2].d2 = 0; | |
| 6526 | ✗ | midi_dlg[4].flags = D_EXIT; | |
| 6527 | ✗ | midi_dlg[5].flags = (tunes[midi_dlg[2].d1].flags&tfDISABLESAVE) ? D_DISABLED : D_EXIT; | |
| 6528 | |||
| 6529 | ✗ | listening = false; | |
| 6530 | ✗ | dialog_running=false; | |
| 6531 | ✗ | get_info(0); | |
| 6532 | |||
| 6533 | ✗ | dialog_running=true; | |
| 6534 | |||
| 6535 | ✗ | large_dialog(midi_dlg); | |
| 6536 | |||
| 6537 | ✗ | zc_popup_dialog(midi_dlg,0); | |
| 6538 | ✗ | dialog_running=false; | |
| 6539 | |||
| 6540 | ✗ | if(listening) | |
| 6541 | ✗ | music_stop(); | |
| 6542 | |||
| 6543 | ✗ | if(do_pause_midi) | |
| 6544 | { | ||
| 6545 | // TODO: this probably doesn't resume midis nicely when scrolling (or in some other inner-gameloop). | ||
| 6546 | ✗ | midi_suspended = midissuspRESUME; | |
| 6547 | ✗ | currmidi = restore_midi; | |
| 6548 | ✗ | midi_pos = paused_midi_pos; | |
| 6549 | ✗ | } | |
| 6550 | |||
| 6551 | ✗ | if(text) free(text); | |
| 6552 | ✗ | if(zmi) free(zmi); | |
| 6553 | ✗ | return D_O_K; | |
| 6554 | ✗ | } | |
| 6555 | |||
| 6556 | ✗ | int32_t onAbout() | |
| 6557 | { | ||
| 6558 | ✗ | char buf1[80]={0}; | |
| 6559 | ✗ | std::ostringstream oss; | |
| 6560 | ✗ | sprintf(buf1,"%s (%s), Version: %s", ZC_PLAYER_NAME,PROJECT_NAME,ZC_PLAYER_V); | |
| 6561 | ✗ | oss << buf1 << '\n'; | |
| 6562 | ✗ | sprintf(buf1, "%s, Build %d", ALPHA_VER_STR, VERSION_BUILD); | |
| 6563 | ✗ | oss << buf1 << '\n'; | |
| 6564 | ✗ | sprintf(buf1,"Build Date: %s %s, %d at @ %s %s", dayextension(BUILDTM_DAY).c_str(), (char*)months[BUILDTM_MONTH], BUILDTM_YEAR, __TIME__, __TIMEZONE__); | |
| 6565 | ✗ | oss << buf1 << '\n'; | |
| 6566 | ✗ | sprintf(buf1, "Built By: %s", DEV_SIGNOFF); | |
| 6567 | ✗ | oss << buf1 << '\n'; | |
| 6568 | ✗ | sprintf(buf1, "Tag: %s", getReleaseTag()); | |
| 6569 | ✗ | oss << buf1 << '\n'; | |
| 6570 | |||
| 6571 | ✗ | InfoDialog("About ZC", oss.str()).show(); | |
| 6572 | return D_O_K; | ||
| 6573 | ✗ | } | |
| 6574 | |||
| 6575 | ✗ | int32_t onQuest() | |
| 6576 | { | ||
| 6577 | char fname[100]; | ||
| 6578 | ✗ | strcpy(fname, get_filename(qstpath)); | |
| 6579 | ✗ | quest_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6580 | ✗ | quest_dlg[1].dp = fname; | |
| 6581 | |||
| 6582 | ✗ | if(QHeader.quest_number==0) | |
| 6583 | ✗ | sprintf(str_a,"Custom"); | |
| 6584 | else | ||
| 6585 | ✗ | sprintf(str_a,"%d",QHeader.quest_number); | |
| 6586 | |||
| 6587 | ✗ | sprintf(str_s,"%s",VerStr(QHeader.zelda_version)); | |
| 6588 | |||
| 6589 | ✗ | quest_dlg[11].d1 = quest_dlg[9].d1 = 0; | |
| 6590 | ✗ | quest_dlg[11].d2 = quest_dlg[9].d2 = 0; | |
| 6591 | |||
| 6592 | ✗ | large_dialog(quest_dlg); | |
| 6593 | |||
| 6594 | ✗ | zc_popup_dialog(quest_dlg, 0); | |
| 6595 | ✗ | return D_O_K; | |
| 6596 | } | ||
| 6597 | |||
| 6598 | void call_vidmode_dlg(); | ||
| 6599 | ✗ | int32_t onVidMode() | |
| 6600 | { | ||
| 6601 | ✗ | call_vidmode_dlg(); | |
| 6602 | ✗ | return D_O_K; | |
| 6603 | } | ||
| 6604 | |||
| 6605 | #define addToHash(c,b,h) if(h->find(c ## key) == h->end()) \ | ||
| 6606 | {(*h)[c ## key]=true;} else { if ( c ## key != 0 ) b = false;} | ||
| 6607 | //Added an extra statement, so that if the key is cleared to 0, the cleared | ||
| 6608 | //keybinding status need not be unique. -Z ( 1st April, 2019 ) | ||
| 6609 | |||
| 6610 | ✗ | void load_ukeys(int32_t* arr) | |
| 6611 | { | ||
| 6612 | ✗ | arr[ukey_a] = Akey; | |
| 6613 | ✗ | arr[ukey_b] = Bkey; | |
| 6614 | ✗ | arr[ukey_s] = Skey; | |
| 6615 | ✗ | arr[ukey_l] = Lkey; | |
| 6616 | ✗ | arr[ukey_r] = Rkey; | |
| 6617 | ✗ | arr[ukey_p] = Pkey; | |
| 6618 | ✗ | arr[ukey_ex1] = Exkey1; | |
| 6619 | ✗ | arr[ukey_ex2] = Exkey2; | |
| 6620 | ✗ | arr[ukey_ex3] = Exkey3; | |
| 6621 | ✗ | arr[ukey_ex4] = Exkey4; | |
| 6622 | ✗ | arr[ukey_du] = DUkey; | |
| 6623 | ✗ | arr[ukey_dd] = DDkey; | |
| 6624 | ✗ | arr[ukey_dl] = DLkey; | |
| 6625 | ✗ | arr[ukey_dr] = DRkey; | |
| 6626 | ✗ | arr[ukey_mod1a] = cheat_modifier_keys[0]; | |
| 6627 | ✗ | arr[ukey_mod1b] = cheat_modifier_keys[1]; | |
| 6628 | ✗ | arr[ukey_mod2a] = cheat_modifier_keys[2]; | |
| 6629 | ✗ | arr[ukey_mod2b] = cheat_modifier_keys[3]; | |
| 6630 | ✗ | }; | |
| 6631 | |||
| 6632 | static const char* ukey_names[] = { | ||
| 6633 | "A", "B", "Start", "L", "R", "Map", | ||
| 6634 | "Ex1", "Ex2", "Ex3", "Ex4", "Up", "Down", | ||
| 6635 | "Left", "Right", "Cheat Mod L1", "Cheat Mod L2", | ||
| 6636 | "Cheat Mod R1", "Cheat Mod R2", | ||
| 6637 | }; | ||
| 6638 | ✗ | std::string get_ukey_name(int32_t k) | |
| 6639 | { | ||
| 6640 | ✗ | if (k < num_ukey) return ukey_names[k]; | |
| 6641 | ✗ | return ""; | |
| 6642 | ✗ | } | |
| 6643 | |||
| 6644 | ✗ | int32_t onKeyboard() | |
| 6645 | { | ||
| 6646 | ✗ | int32_t a = Akey; | |
| 6647 | ✗ | int32_t b = Bkey; | |
| 6648 | ✗ | int32_t s = Skey; | |
| 6649 | ✗ | int32_t l = Lkey; | |
| 6650 | ✗ | int32_t r = Rkey; | |
| 6651 | ✗ | int32_t p = Pkey; | |
| 6652 | ✗ | int32_t ex1 = Exkey1; | |
| 6653 | ✗ | int32_t ex2 = Exkey2; | |
| 6654 | ✗ | int32_t ex3 = Exkey3; | |
| 6655 | ✗ | int32_t ex4 = Exkey4; | |
| 6656 | ✗ | int32_t du = DUkey; | |
| 6657 | ✗ | int32_t dd = DDkey; | |
| 6658 | ✗ | int32_t dl = DLkey; | |
| 6659 | ✗ | int32_t dr = DRkey; | |
| 6660 | ✗ | int32_t mod1a = cheat_modifier_keys[0]; | |
| 6661 | ✗ | int32_t mod1b = cheat_modifier_keys[1]; | |
| 6662 | ✗ | int32_t mod2a = cheat_modifier_keys[2]; | |
| 6663 | ✗ | int32_t mod2b = cheat_modifier_keys[3]; | |
| 6664 | ✗ | bool done=false; | |
| 6665 | int32_t ret; | ||
| 6666 | |||
| 6667 | ✗ | keyboard_control_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6668 | |||
| 6669 | ✗ | large_dialog(keyboard_control_dlg); | |
| 6670 | |||
| 6671 | ✗ | while(!done) | |
| 6672 | { | ||
| 6673 | ✗ | ret = zc_popup_dialog(keyboard_control_dlg,3); | |
| 6674 | |||
| 6675 | ✗ | if(ret==3) // OK | |
| 6676 | { | ||
| 6677 | int32_t ukeys[num_ukey]; | ||
| 6678 | ✗ | load_ukeys(ukeys); | |
| 6679 | ✗ | std::vector<std::string> uniqueError; | |
| 6680 | ✗ | for(int32_t q = 0; q < num_ukey; ++q) | |
| 6681 | { | ||
| 6682 | ✗ | for(int32_t p = q+1; p < num_ukey; ++p) | |
| 6683 | { | ||
| 6684 | ✗ | if(ukeys[q] == ukeys[p] && ukeys[q] != 0) | |
| 6685 | { | ||
| 6686 | char buf[64]; | ||
| 6687 | ✗ | sprintf(buf, "'%s' conflicts with '%s'", get_ukey_name(q).c_str(), get_ukey_name(p).c_str()); | |
| 6688 | ✗ | std::string str(buf); | |
| 6689 | ✗ | uniqueError.push_back(str); | |
| 6690 | ✗ | } | |
| 6691 | ✗ | } | |
| 6692 | ✗ | } | |
| 6693 | ✗ | if(uniqueError.size() == 0) | |
| 6694 | { | ||
| 6695 | ✗ | done = true; | |
| 6696 | ✗ | save_control_configs(true); | |
| 6697 | ✗ | } | |
| 6698 | else | ||
| 6699 | { | ||
| 6700 | ✗ | box_start(1, "Duplicate Keys", get_zc_font(font_lfont), get_zc_font(font_sfont), false, keyboard_control_dlg[0].w,keyboard_control_dlg[0].h, 2); | |
| 6701 | ✗ | box_out("Cannot have duplicate keybinds!"); box_eol(); | |
| 6702 | ✗ | for(std::vector<std::string>::iterator it = uniqueError.begin(); | |
| 6703 | ✗ | it != uniqueError.end(); ++it) | |
| 6704 | { | ||
| 6705 | ✗ | box_out((*it).c_str()); box_eol(); | |
| 6706 | ✗ | } | |
| 6707 | ✗ | box_end(true); | |
| 6708 | } | ||
| 6709 | ✗ | } | |
| 6710 | else // Cancel | ||
| 6711 | { | ||
| 6712 | ✗ | Akey = a; | |
| 6713 | ✗ | Bkey = b; | |
| 6714 | ✗ | Skey = s; | |
| 6715 | ✗ | Lkey = l; | |
| 6716 | ✗ | Rkey = r; | |
| 6717 | ✗ | Pkey = p; | |
| 6718 | ✗ | Exkey1 = ex1; | |
| 6719 | ✗ | Exkey2 = ex2; | |
| 6720 | ✗ | Exkey3 = ex3; | |
| 6721 | ✗ | Exkey4 = ex4; | |
| 6722 | ✗ | DUkey = du; | |
| 6723 | ✗ | DDkey = dd; | |
| 6724 | ✗ | DLkey = dl; | |
| 6725 | ✗ | DRkey = dr; | |
| 6726 | ✗ | cheat_modifier_keys[0] = mod1a; | |
| 6727 | ✗ | cheat_modifier_keys[1] = mod1b; | |
| 6728 | ✗ | cheat_modifier_keys[2] = mod2a; | |
| 6729 | ✗ | cheat_modifier_keys[3] = mod2b; | |
| 6730 | |||
| 6731 | ✗ | done=true; | |
| 6732 | } | ||
| 6733 | |||
| 6734 | ✗ | rest(1); | |
| 6735 | } | ||
| 6736 | |||
| 6737 | ✗ | return D_O_K; | |
| 6738 | ✗ | } | |
| 6739 | |||
| 6740 | ✗ | int32_t onGamepad() | |
| 6741 | { | ||
| 6742 | ✗ | int32_t a = Abtn; | |
| 6743 | ✗ | int32_t b = Bbtn; | |
| 6744 | ✗ | int32_t s = Sbtn; | |
| 6745 | ✗ | int32_t l = Lbtn; | |
| 6746 | ✗ | int32_t r = Rbtn; | |
| 6747 | ✗ | int32_t m = Mbtn; | |
| 6748 | ✗ | int32_t p = Pbtn; | |
| 6749 | ✗ | int32_t ex1 = Exbtn1; | |
| 6750 | ✗ | int32_t ex2 = Exbtn2; | |
| 6751 | ✗ | int32_t ex3 = Exbtn3; | |
| 6752 | ✗ | int32_t ex4 = Exbtn4; | |
| 6753 | ✗ | int32_t up = DUbtn; | |
| 6754 | ✗ | int32_t down = DDbtn; | |
| 6755 | ✗ | int32_t left = DLbtn; | |
| 6756 | ✗ | int32_t right = DRbtn; | |
| 6757 | |||
| 6758 | ✗ | gamepad_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6759 | ✗ | if(analog_movement) | |
| 6760 | ✗ | gamepad_dlg[56].flags|=D_SELECTED; | |
| 6761 | else | ||
| 6762 | ✗ | gamepad_dlg[56].flags&=~D_SELECTED; | |
| 6763 | |||
| 6764 | ✗ | large_dialog(gamepad_dlg); | |
| 6765 | |||
| 6766 | ✗ | int32_t ret = zc_popup_dialog(gamepad_dlg,4); | |
| 6767 | |||
| 6768 | ✗ | if(ret == 4) //OK | |
| 6769 | { | ||
| 6770 | ✗ | analog_movement = gamepad_dlg[56].flags&D_SELECTED; | |
| 6771 | ✗ | save_control_configs(false); | |
| 6772 | ✗ | } | |
| 6773 | else //Cancel | ||
| 6774 | { | ||
| 6775 | ✗ | Abtn = a; | |
| 6776 | ✗ | Bbtn = b; | |
| 6777 | ✗ | Sbtn = s; | |
| 6778 | ✗ | Lbtn = l; | |
| 6779 | ✗ | Rbtn = r; | |
| 6780 | ✗ | Mbtn = m; | |
| 6781 | ✗ | Pbtn = p; | |
| 6782 | ✗ | Exbtn1 = ex1; | |
| 6783 | ✗ | Exbtn2 = ex2; | |
| 6784 | ✗ | Exbtn3 = ex3; | |
| 6785 | ✗ | Exbtn4 = ex4; | |
| 6786 | ✗ | DUbtn = up; | |
| 6787 | ✗ | DDbtn = down; | |
| 6788 | ✗ | DLbtn = left; | |
| 6789 | ✗ | DRbtn = right; | |
| 6790 | } | ||
| 6791 | |||
| 6792 | ✗ | return D_O_K; | |
| 6793 | } | ||
| 6794 | |||
| 6795 | ✗ | int32_t onCheatKeys() | |
| 6796 | { | ||
| 6797 | int32_t oldcheats[Cheat::Last][2]; | ||
| 6798 | ✗ | memcpy(oldcheats, cheatkeys, sizeof(cheatkeys)); | |
| 6799 | |||
| 6800 | ✗ | bool done=false; | |
| 6801 | |||
| 6802 | ✗ | while(!done) | |
| 6803 | { | ||
| 6804 | ✗ | bool confirm = false; | |
| 6805 | ✗ | CheatKeysDialog(&confirm).show(); | |
| 6806 | ✗ | if(confirm) // OK | |
| 6807 | { | ||
| 6808 | ✗ | std::vector<std::string> uniqueError; | |
| 6809 | char buf[512]; | ||
| 6810 | ✗ | for(size_t q = 1; q < Cheat::Last; ++q) | |
| 6811 | { | ||
| 6812 | ✗ | if(cheatkeys[q][1] && !cheatkeys[q][0]) | |
| 6813 | { | ||
| 6814 | ✗ | cheatkeys[q][0] = cheatkeys[q][1]; | |
| 6815 | ✗ | cheatkeys[q][1] = 0; | |
| 6816 | ✗ | } | |
| 6817 | ✗ | } | |
| 6818 | ✗ | for(size_t q = 1; q < Cheat::Last; ++q) | |
| 6819 | { | ||
| 6820 | ✗ | if(!bindable_cheat((Cheat)q)) continue; | |
| 6821 | ✗ | for(size_t p = q+1; p < Cheat::Last; ++p) | |
| 6822 | { | ||
| 6823 | ✗ | if(!bindable_cheat((Cheat)p)) continue; | |
| 6824 | ✗ | for(size_t q2 = 0; q2 <= 1; ++q2) | |
| 6825 | ✗ | for(size_t p2 = 0; p2 <= 1; ++p2) | |
| 6826 | { | ||
| 6827 | ✗ | if(cheatkeys[q][q2] == cheatkeys[p][p2] && cheatkeys[q][q2] != 0) | |
| 6828 | { | ||
| 6829 | ✗ | uniqueError.push_back(fmt::format("'{}' ({}) conflicts with '{}' ({}) - both '{}'", | |
| 6830 | ✗ | cheat_to_string((Cheat)q), q2?"Alt":"Main", | |
| 6831 | ✗ | cheat_to_string((Cheat)p), p2?"Alt":"Main", | |
| 6832 | ✗ | get_keystr(cheatkeys[q][q2]))); | |
| 6833 | ✗ | } | |
| 6834 | ✗ | } | |
| 6835 | ✗ | } | |
| 6836 | ✗ | } | |
| 6837 | ✗ | if(uniqueError.size() == 0) | |
| 6838 | { | ||
| 6839 | ✗ | done = true; | |
| 6840 | ✗ | save_cheatkeys(); | |
| 6841 | ✗ | } | |
| 6842 | else | ||
| 6843 | { | ||
| 6844 | ✗ | box_start(1, "Duplicate Keys", get_zc_font(font_lfont), get_zc_font(font_sfont), false, 500,400, 2); | |
| 6845 | ✗ | box_out("Cannot have duplicate keybinds!"); box_eol(); | |
| 6846 | ✗ | for(std::vector<std::string>::iterator it = uniqueError.begin(); | |
| 6847 | ✗ | it != uniqueError.end(); ++it) | |
| 6848 | { | ||
| 6849 | ✗ | box_out((*it).c_str()); box_eol(); | |
| 6850 | ✗ | } | |
| 6851 | ✗ | box_end(true); | |
| 6852 | } | ||
| 6853 | ✗ | } | |
| 6854 | else // Cancel | ||
| 6855 | { | ||
| 6856 | ✗ | memcpy(cheatkeys, oldcheats, sizeof(cheatkeys)); | |
| 6857 | ✗ | done=true; | |
| 6858 | } | ||
| 6859 | ✗ | rest(1); | |
| 6860 | } | ||
| 6861 | |||
| 6862 | ✗ | return D_O_K; | |
| 6863 | ✗ | } | |
| 6864 | |||
| 6865 | ✗ | int32_t onSound() | |
| 6866 | { | ||
| 6867 | ✗ | if ( FFCore.coreflags&FFCORE_SCRIPTED_MIDI_VOLUME ) | |
| 6868 | { | ||
| 6869 | ✗ | master_volume(-1,((int32_t)FFCore.usr_midi_volume)); | |
| 6870 | ✗ | } | |
| 6871 | ✗ | if ( FFCore.coreflags&FFCORE_SCRIPTED_DIGI_VOLUME ) | |
| 6872 | { | ||
| 6873 | ✗ | master_volume((int32_t)(FFCore.usr_digi_volume),1); | |
| 6874 | ✗ | } | |
| 6875 | ✗ | if ( FFCore.coreflags&FFCORE_SCRIPTED_MUSIC_VOLUME ) | |
| 6876 | { | ||
| 6877 | ✗ | emusic_volume = (int32_t)FFCore.usr_music_volume; | |
| 6878 | ✗ | } | |
| 6879 | ✗ | if ( FFCore.coreflags&FFCORE_SCRIPTED_SFX_VOLUME ) | |
| 6880 | { | ||
| 6881 | ✗ | sfx_volume = (int32_t)FFCore.usr_sfx_volume; | |
| 6882 | ✗ | } | |
| 6883 | ✗ | if ( FFCore.coreflags&FFCORE_SCRIPTED_PANSTYLE ) | |
| 6884 | { | ||
| 6885 | ✗ | pan_style = (int32_t)FFCore.usr_panstyle; | |
| 6886 | ✗ | } | |
| 6887 | |||
| 6888 | ✗ | int32_t m = midi_volume; | |
| 6889 | ✗ | int32_t d = digi_volume; | |
| 6890 | ✗ | int32_t e = emusic_volume; | |
| 6891 | ✗ | int32_t b = zcmusic_bufsz; | |
| 6892 | ✗ | int32_t s = sfx_volume; | |
| 6893 | ✗ | int32_t p = pan_style; | |
| 6894 | ✗ | pan_style = vbound(pan_style,0,3); | |
| 6895 | |||
| 6896 | ✗ | sound_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6897 | |||
| 6898 | ✗ | large_dialog(sound_dlg); | |
| 6899 | |||
| 6900 | ✗ | midi_dp[1] = sound_dlg[6].x; | |
| 6901 | ✗ | midi_dp[2] = sound_dlg[6].y; | |
| 6902 | ✗ | digi_dp[1] = sound_dlg[7].x; | |
| 6903 | ✗ | digi_dp[2] = sound_dlg[7].y; | |
| 6904 | ✗ | emus_dp[1] = sound_dlg[8].x; | |
| 6905 | ✗ | emus_dp[2] = sound_dlg[8].y; | |
| 6906 | ✗ | buf_dp[1] = sound_dlg[9].x; | |
| 6907 | ✗ | buf_dp[2] = sound_dlg[9].y; | |
| 6908 | ✗ | sfx_dp[1] = sound_dlg[10].x; | |
| 6909 | ✗ | sfx_dp[2] = sound_dlg[10].y; | |
| 6910 | ✗ | pan_dp[1] = sound_dlg[11].x; | |
| 6911 | ✗ | pan_dp[2] = sound_dlg[11].y; | |
| 6912 | ✗ | sound_dlg[15].d2 = (midi_volume==255) ? 32 : midi_volume>>3; | |
| 6913 | ✗ | sound_dlg[16].d2 = (digi_volume==255) ? 32 : digi_volume>>3; | |
| 6914 | ✗ | sound_dlg[17].d2 = (emusic_volume==255) ? 32 : emusic_volume>>3; | |
| 6915 | ✗ | sound_dlg[18].d2 = zcmusic_bufsz; | |
| 6916 | ✗ | sound_dlg[19].d2 = (sfx_volume==255) ? 32 : sfx_volume>>3; | |
| 6917 | ✗ | sound_dlg[20].d2 = pan_style; | |
| 6918 | |||
| 6919 | ✗ | int32_t ret = zc_popup_dialog(sound_dlg,1); | |
| 6920 | |||
| 6921 | ✗ | if(ret==2) | |
| 6922 | { | ||
| 6923 | ✗ | master_volume(digi_volume,midi_volume); | |
| 6924 | |||
| 6925 | ✗ | for(int32_t i=0; i<WAV_COUNT; ++i) | |
| 6926 | { | ||
| 6927 | //allegro assertion fails when passing in -1 as voice -DD | ||
| 6928 | ✗ | if(sfx_voice[i] > 0) | |
| 6929 | ✗ | voice_set_volume(sfx_voice[i], sfx_volume); | |
| 6930 | ✗ | } | |
| 6931 | ✗ | zc_set_config(sfx_sect,"digi",digi_volume); | |
| 6932 | ✗ | zc_set_config(sfx_sect,"midi",midi_volume); | |
| 6933 | ✗ | zc_set_config(sfx_sect,"sfx",sfx_volume); | |
| 6934 | ✗ | zc_set_config(sfx_sect,"emusic",emusic_volume); | |
| 6935 | ✗ | zc_set_config(sfx_sect,"pan",pan_style); | |
| 6936 | ✗ | zc_set_config(sfx_sect,"zcmusic_bufsz",zcmusic_bufsz); | |
| 6937 | ✗ | } | |
| 6938 | else | ||
| 6939 | { | ||
| 6940 | ✗ | midi_volume = m; | |
| 6941 | ✗ | digi_volume = d; | |
| 6942 | ✗ | emusic_volume = e; | |
| 6943 | ✗ | zcmusic_bufsz = b; | |
| 6944 | ✗ | sfx_volume = s; | |
| 6945 | ✗ | pan_style = p; | |
| 6946 | } | ||
| 6947 | |||
| 6948 | ✗ | return D_O_K; | |
| 6949 | } | ||
| 6950 | |||
| 6951 | ✗ | int32_t queding(char const* s1, char const* s2, char const* s3) | |
| 6952 | { | ||
| 6953 | ✗ | return jwin_alert(ZC_str,s1,s2,s3,"&Yes","&No",'y','n',get_zc_font(font_lfont)); | |
| 6954 | } | ||
| 6955 | |||
| 6956 | ✗ | int32_t onQuit() | |
| 6957 | { | ||
| 6958 | ✗ | if(Playing) | |
| 6959 | { | ||
| 6960 | ✗ | int32_t ret=0; | |
| 6961 | |||
| 6962 | ✗ | if(get_qr(qr_NOCONTINUE)) | |
| 6963 | { | ||
| 6964 | ✗ | if(standalone_mode) | |
| 6965 | { | ||
| 6966 | ✗ | ret=queding("End current game?", | |
| 6967 | "The continue screen is disabled; the game", | ||
| 6968 | "will be reloaded from the last save."); | ||
| 6969 | ✗ | } | |
| 6970 | else | ||
| 6971 | { | ||
| 6972 | ✗ | ret=queding("End current game?", | |
| 6973 | "The continue screen is disabled. You will", | ||
| 6974 | "be returned to the file select screen."); | ||
| 6975 | } | ||
| 6976 | ✗ | } | |
| 6977 | else | ||
| 6978 | ✗ | ret=queding("End current game?",NULL,NULL); | |
| 6979 | |||
| 6980 | ✗ | if(ret==1) | |
| 6981 | { | ||
| 6982 | ✗ | disableClickToFreeze=false; | |
| 6983 | ✗ | Quit=qQUIT; | |
| 6984 | |||
| 6985 | // Trying to evade a door repair charge? | ||
| 6986 | ✗ | if(repaircharge) | |
| 6987 | { | ||
| 6988 | ✗ | game->change_drupy(-repaircharge); | |
| 6989 | ✗ | repaircharge=0; | |
| 6990 | ✗ | } | |
| 6991 | |||
| 6992 | ✗ | return D_CLOSE; | |
| 6993 | } | ||
| 6994 | ✗ | } | |
| 6995 | |||
| 6996 | ✗ | return D_O_K; | |
| 6997 | ✗ | } | |
| 6998 | |||
| 6999 | ✗ | int32_t onTryQuitMenu() | |
| 7000 | { | ||
| 7001 | ✗ | return onTryQuit(true); | |
| 7002 | } | ||
| 7003 | |||
| 7004 | ✗ | int32_t onTryQuit(bool inMenu) | |
| 7005 | { | ||
| 7006 | ✗ | if(Playing && !(GameFlags & GAMEFLAG_NO_F6)) | |
| 7007 | { | ||
| 7008 | ✗ | if(active_cutscene.can_f6()) | |
| 7009 | { | ||
| 7010 | ✗ | if(get_qr(qr_OLD_F6)) | |
| 7011 | { | ||
| 7012 | ✗ | if(inMenu) onQuit(); | |
| 7013 | ✗ | else /*if(!get_qr(qr_NOCONTINUE))*/ f_Quit(qQUIT); | |
| 7014 | ✗ | } | |
| 7015 | else | ||
| 7016 | { | ||
| 7017 | ✗ | disableClickToFreeze=false; | |
| 7018 | ✗ | GameFlags |= GAMEFLAG_TRYQUIT; | |
| 7019 | } | ||
| 7020 | ✗ | return D_CLOSE; | |
| 7021 | } | ||
| 7022 | ✗ | else active_cutscene.error(); | |
| 7023 | ✗ | } | |
| 7024 | |||
| 7025 | ✗ | return D_O_K; | |
| 7026 | ✗ | } | |
| 7027 | |||
| 7028 | ✗ | int32_t onReset() | |
| 7029 | { | ||
| 7030 | ✗ | if(queding(" Reset system? ",NULL,NULL)==1) | |
| 7031 | { | ||
| 7032 | ✗ | disableClickToFreeze=false; | |
| 7033 | ✗ | Quit=qRESET; | |
| 7034 | ✗ | replay_quit(); | |
| 7035 | ✗ | return D_CLOSE; | |
| 7036 | } | ||
| 7037 | |||
| 7038 | ✗ | return D_O_K; | |
| 7039 | ✗ | } | |
| 7040 | |||
| 7041 | ✗ | int32_t onExit() | |
| 7042 | { | ||
| 7043 | ✗ | if(queding(" Quit ZQuest Classic? ",NULL,NULL)==1) | |
| 7044 | { | ||
| 7045 | ✗ | Quit=qEXIT; | |
| 7046 | ✗ | return D_CLOSE; | |
| 7047 | } | ||
| 7048 | |||
| 7049 | ✗ | return D_O_K; | |
| 7050 | ✗ | } | |
| 7051 | |||
| 7052 | ✗ | int32_t onTitle_NES() | |
| 7053 | { | ||
| 7054 | ✗ | title_version=0; | |
| 7055 | ✗ | zc_set_config(cfg_sect,"title",title_version); | |
| 7056 | ✗ | return D_O_K; | |
| 7057 | } | ||
| 7058 | ✗ | int32_t onTitle_DX() | |
| 7059 | { | ||
| 7060 | ✗ | title_version=1; | |
| 7061 | ✗ | zc_set_config(cfg_sect,"title",title_version); | |
| 7062 | ✗ | return D_O_K; | |
| 7063 | } | ||
| 7064 | ✗ | int32_t onTitle_25() | |
| 7065 | { | ||
| 7066 | ✗ | title_version=2; | |
| 7067 | ✗ | zc_set_config(cfg_sect,"title",title_version); | |
| 7068 | ✗ | return D_O_K; | |
| 7069 | } | ||
| 7070 | |||
| 7071 | ✗ | int32_t onDebug() | |
| 7072 | { | ||
| 7073 | ✗ | if(debug_enabled) | |
| 7074 | ✗ | set_debug(!get_debug()); | |
| 7075 | ✗ | return D_O_K; | |
| 7076 | } | ||
| 7077 | |||
| 7078 | ✗ | int32_t onHeartBeep() | |
| 7079 | { | ||
| 7080 | ✗ | heart_beep=!heart_beep; | |
| 7081 | ✗ | zc_set_config(cfg_sect,"heart_beep",heart_beep); | |
| 7082 | ✗ | return D_O_K; | |
| 7083 | } | ||
| 7084 | |||
| 7085 | ✗ | int32_t onSaveIndicator() | |
| 7086 | { | ||
| 7087 | ✗ | use_save_indicator = use_save_indicator ? 0 : 1; | |
| 7088 | ✗ | zc_set_config(cfg_sect,"save_indicator",use_save_indicator); | |
| 7089 | ✗ | return D_O_K; | |
| 7090 | } | ||
| 7091 | |||
| 7092 | ✗ | int32_t onEpilepsy() | |
| 7093 | { | ||
| 7094 | ✗ | if(jwin_alert3( | |
| 7095 | "Epilepsy Flash Reduction", | ||
| 7096 | "Enabling this will reduce the intensity of flashing and screen wave effects.", | ||
| 7097 | "Disabling this will restore standard flash and wavy behaviour.", | ||
| 7098 | "Proceed?", | ||
| 7099 | "&Yes", | ||
| 7100 | "&No", | ||
| 7101 | NULL, | ||
| 7102 | 'y', | ||
| 7103 | 'n', | ||
| 7104 | 0, | ||
| 7105 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 7106 | { | ||
| 7107 | ✗ | epilepsyFlashReduction = epilepsyFlashReduction ? 0 : 1; | |
| 7108 | ✗ | zc_set_config("zeldadx","checked_epilepsy",1); | |
| 7109 | ✗ | zc_set_config(cfg_sect,"epilepsy_flash_reduction",epilepsyFlashReduction); | |
| 7110 | ✗ | } | |
| 7111 | ✗ | return D_O_K; | |
| 7112 | } | ||
| 7113 | |||
| 7114 | ✗ | int32_t onTriforce() | |
| 7115 | { | ||
| 7116 | ✗ | for(int32_t i=0; i<MAXINITTABS; ++i) | |
| 7117 | { | ||
| 7118 | ✗ | init_tabs[i].flags&=~D_SELECTED; | |
| 7119 | ✗ | } | |
| 7120 | |||
| 7121 | ✗ | init_tabs[3].flags=D_SELECTED; | |
| 7122 | ✗ | return onCheatConsole(); | |
| 7123 | /*triforce_dlg[0].dp2=get_zc_font(font_lfont); | ||
| 7124 | for(int32_t i=1; i<=8; i++) | ||
| 7125 | triforce_dlg[i].flags = (game->lvlitems[i] & liTRIFORCE) ? D_SELECTED : 0; | ||
| 7126 | |||
| 7127 | if(zc_popup_dialog (triforce_dlg,-1)==9) | ||
| 7128 | { | ||
| 7129 | for(int32_t i=1; i<=8; i++) | ||
| 7130 | { | ||
| 7131 | game->lvlitems[i] &= ~liTRIFORCE; | ||
| 7132 | game->lvlitems[i] |= (triforce_dlg[i].flags & D_SELECTED) ? liTRIFORCE : 0; | ||
| 7133 | } | ||
| 7134 | } | ||
| 7135 | return D_O_K;*/ | ||
| 7136 | } | ||
| 7137 | |||
| 7138 | bool rc = false; | ||
| 7139 | /* | ||
| 7140 | int32_t onEquipment() | ||
| 7141 | { | ||
| 7142 | for (int32_t i=0; i<MAXINITTABS; ++i) | ||
| 7143 | { | ||
| 7144 | init_tabs[i].flags&=~D_SELECTED; | ||
| 7145 | } | ||
| 7146 | init_tabs[0].flags=D_SELECTED; | ||
| 7147 | return onCheatConsole(); | ||
| 7148 | } | ||
| 7149 | */ | ||
| 7150 | |||
| 7151 | ✗ | int32_t onItems() | |
| 7152 | { | ||
| 7153 | ✗ | for(int32_t i=0; i<MAXINITTABS; ++i) | |
| 7154 | { | ||
| 7155 | ✗ | init_tabs[i].flags&=~D_SELECTED; | |
| 7156 | ✗ | } | |
| 7157 | |||
| 7158 | ✗ | init_tabs[1].flags=D_SELECTED; | |
| 7159 | ✗ | return onCheatConsole(); | |
| 7160 | } | ||
| 7161 | |||
| 7162 | static DIALOG getnum_dlg[] = | ||
| 7163 | { | ||
| 7164 | // (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) | ||
| 7165 | { jwin_win_proc, 80, 80, 160, 72, vc(0), vc(11), 0, D_EXIT, 0, 0, NULL, NULL, NULL }, | ||
| 7166 | { jwin_text_proc, 104, 104+4, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Number:", NULL, NULL }, | ||
| 7167 | { jwin_edit_proc, 168, 104, 48, 16, 0, 0, 0, 0, 6, 0, NULL, NULL, NULL }, | ||
| 7168 | { jwin_button_proc, 90, 126, 61, 21, vc(0), vc(11), 13, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 7169 | { jwin_button_proc, 170, 126, 61, 21, vc(0), vc(11), 27, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 7170 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 7171 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 7172 | }; | ||
| 7173 | |||
| 7174 | ✗ | int32_t getnumber(const char *prompt,int32_t initialval) | |
| 7175 | { | ||
| 7176 | char buf[20]; | ||
| 7177 | ✗ | sprintf(buf,"%d",initialval); | |
| 7178 | ✗ | getnum_dlg[0].dp=(void *)prompt; | |
| 7179 | ✗ | getnum_dlg[0].dp2=get_zc_font(font_lfont); | |
| 7180 | ✗ | getnum_dlg[2].dp=buf; | |
| 7181 | |||
| 7182 | ✗ | large_dialog(getnum_dlg); | |
| 7183 | |||
| 7184 | ✗ | if(zc_popup_dialog(getnum_dlg,2)==3) | |
| 7185 | ✗ | return atoi(buf); | |
| 7186 | |||
| 7187 | ✗ | return initialval; | |
| 7188 | ✗ | } | |
| 7189 | |||
| 7190 | ✗ | int32_t onLife() | |
| 7191 | { | ||
| 7192 | ✗ | int value = vbound(getnumber("Life",game->get_life()),1,game->get_maxlife()); | |
| 7193 | ✗ | cheats_enqueue(Cheat::Life, value); | |
| 7194 | ✗ | return D_O_K; | |
| 7195 | ✗ | } | |
| 7196 | |||
| 7197 | ✗ | int32_t onHeartC() | |
| 7198 | { | ||
| 7199 | ✗ | int max_life = vbound(getnumber("Heart Containers",game->get_maxlife()/game->get_hp_per_heart()),1,4095) * game->get_hp_per_heart(); | |
| 7200 | ✗ | int life = vbound(getnumber("Life",game->get_life()/game->get_hp_per_heart()),1,max_life/game->get_hp_per_heart())*game->get_hp_per_heart(); | |
| 7201 | ✗ | cheats_enqueue(Cheat::MaxLife, max_life); | |
| 7202 | ✗ | cheats_enqueue(Cheat::Life, life); | |
| 7203 | ✗ | return D_O_K; | |
| 7204 | ✗ | } | |
| 7205 | |||
| 7206 | ✗ | int32_t onMagicC() | |
| 7207 | { | ||
| 7208 | ✗ | int max_magic = vbound(getnumber("Magic Containers",game->get_maxmagic()/game->get_mp_per_block()),0,2047) * game->get_mp_per_block(); | |
| 7209 | ✗ | int magic = vbound(getnumber("Magic",game->get_magic()/game->get_mp_per_block()),0,game->get_maxmagic()/game->get_mp_per_block())*game->get_mp_per_block(); | |
| 7210 | ✗ | cheats_enqueue(Cheat::MaxMagic, max_magic); | |
| 7211 | ✗ | cheats_enqueue(Cheat::Magic, magic); | |
| 7212 | ✗ | return D_O_K; | |
| 7213 | ✗ | } | |
| 7214 | |||
| 7215 | ✗ | int32_t onRupies() | |
| 7216 | { | ||
| 7217 | ✗ | int value = vbound(getnumber("Rupees",game->get_rupies()),0,game->get_maxcounter(1)); | |
| 7218 | ✗ | cheats_enqueue(Cheat::Rupies, value); | |
| 7219 | ✗ | return D_O_K; | |
| 7220 | ✗ | } | |
| 7221 | |||
| 7222 | ✗ | int32_t onMaxBombs() | |
| 7223 | { | ||
| 7224 | ✗ | int value = vbound(getnumber("Max Bombs",game->get_maxbombs()),0,0xFFFF); | |
| 7225 | ✗ | cheats_enqueue(Cheat::MaxBombs, value); | |
| 7226 | ✗ | cheats_enqueue(Cheat::Bombs, value); | |
| 7227 | ✗ | return D_O_K; | |
| 7228 | ✗ | } | |
| 7229 | |||
| 7230 | ✗ | int32_t onRefillLife() | |
| 7231 | { | ||
| 7232 | ✗ | cheats_enqueue(Cheat::Life, game->get_maxlife()); | |
| 7233 | ✗ | return D_O_K; | |
| 7234 | ✗ | } | |
| 7235 | ✗ | int32_t onRefillMagic() | |
| 7236 | { | ||
| 7237 | ✗ | cheats_enqueue(Cheat::Magic, game->get_maxmagic()); | |
| 7238 | ✗ | return D_O_K; | |
| 7239 | ✗ | } | |
| 7240 | ✗ | int32_t onClock() | |
| 7241 | { | ||
| 7242 | ✗ | cheats_enqueue(Cheat::Clock); | |
| 7243 | ✗ | return D_O_K; | |
| 7244 | ✗ | } | |
| 7245 | |||
| 7246 | ✗ | int32_t onQstPath() | |
| 7247 | { | ||
| 7248 | char path[2048]; | ||
| 7249 | |||
| 7250 | ✗ | chop_path(qstdir); | |
| 7251 | ✗ | strcpy(path,qstdir); | |
| 7252 | |||
| 7253 | ✗ | go(); | |
| 7254 | |||
| 7255 | ✗ | if(jwin_dfile_select_ex("Quest File Directory", path, "qst", 2048, -1, -1, get_zc_font(font_lfont))) | |
| 7256 | { | ||
| 7257 | ✗ | chop_path(path); | |
| 7258 | ✗ | fix_filename_case(path); | |
| 7259 | ✗ | fix_filename_slashes(path); | |
| 7260 | ✗ | strcpy(qstdir,path); | |
| 7261 | ✗ | strcpy(qstpath,qstdir); | |
| 7262 | ✗ | } | |
| 7263 | |||
| 7264 | ✗ | comeback(); | |
| 7265 | ✗ | return D_O_K; | |
| 7266 | } | ||
| 7267 | |||
| 7268 | #include "dialog/cheat_dialog.h" | ||
| 7269 | ✗ | int32_t onCheat() | |
| 7270 | { | ||
| 7271 | ✗ | call_setcheat_dialog(); | |
| 7272 | ✗ | game->set_cheat(maxcheat); | |
| 7273 | ✗ | if(cheat) game->did_cheat(true); | |
| 7274 | ✗ | return D_O_K; | |
| 7275 | } | ||
| 7276 | |||
| 7277 | ✗ | int32_t onCheatRupies() | |
| 7278 | { | ||
| 7279 | ✗ | cheats_enqueue(Cheat::Rupies, game->get_maxcounter(1)); | |
| 7280 | ✗ | return D_O_K; | |
| 7281 | ✗ | } | |
| 7282 | |||
| 7283 | ✗ | int32_t onCheatArrows() | |
| 7284 | { | ||
| 7285 | ✗ | cheats_enqueue(Cheat::Arrows, game->get_maxarrows()); | |
| 7286 | ✗ | return D_O_K; | |
| 7287 | ✗ | } | |
| 7288 | |||
| 7289 | ✗ | int32_t onCheatBombs() | |
| 7290 | { | ||
| 7291 | ✗ | cheats_enqueue(Cheat::Bombs, game->get_maxbombs(), game->get_maxcounter(6)); | |
| 7292 | ✗ | return D_O_K; | |
| 7293 | ✗ | } | |
| 7294 | |||
| 7295 | // *** screen saver | ||
| 7296 | |||
| 7297 | 9284954 | int32_t after_time() | |
| 7298 | { | ||
| 7299 |
1/2✓ Branch 0 taken 9284954 times.
✗ Branch 1 not taken.
|
9284954 | if(ss_enable == 0) |
| 7300 | ✗ | return INT_MAX; | |
| 7301 | |||
| 7302 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9284954 times.
|
9284954 | if(ss_after <= 0) |
| 7303 | ✗ | return 5 * 60; | |
| 7304 | |||
| 7305 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9284954 times.
|
9284954 | if(ss_after <= 3) |
| 7306 | ✗ | return ss_after * 15 * 60; | |
| 7307 | |||
| 7308 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9284954 times.
|
9284954 | if(ss_after <= 13) |
| 7309 | ✗ | return (ss_after - 3) * 60 * 60; | |
| 7310 | |||
| 7311 | 9284954 | return MAX_IDLE + 1; | |
| 7312 | 9284954 | } | |
| 7313 | |||
| 7314 | static const char *after_str[15] = | ||
| 7315 | { | ||
| 7316 | " 5 sec", "15 sec", "30 sec", "45 sec", " 1 min", " 2 min", " 3 min", | ||
| 7317 | " 4 min", " 5 min", " 6 min", " 7 min", " 8 min", " 9 min", "10 min", | ||
| 7318 | "Never" | ||
| 7319 | }; | ||
| 7320 | |||
| 7321 | ✗ | const char *after_list(int32_t index, int32_t *list_size) | |
| 7322 | { | ||
| 7323 | ✗ | if(index < 0) | |
| 7324 | { | ||
| 7325 | ✗ | *list_size = 15; | |
| 7326 | ✗ | return NULL; | |
| 7327 | } | ||
| 7328 | |||
| 7329 | ✗ | return after_str[index]; | |
| 7330 | ✗ | } | |
| 7331 | |||
| 7332 | 46 | static ListData after__list(after_list, &font); | |
| 7333 | |||
| 7334 | static DIALOG scrsaver_dlg[] = | ||
| 7335 | { | ||
| 7336 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 7337 | 46 | { jwin_win_proc, 32, 64, 256, 136, 0, 0, 0, D_EXIT, 0, 0, (void *) "Screen Saver Settings", NULL, NULL }, | |
| 7338 | 46 | { jwin_frame_proc, 42, 92, 236, 70, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | |
| 7339 | 46 | { jwin_text_proc, 60, 104, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Run After", NULL, NULL }, | |
| 7340 | 46 | { jwin_text_proc, 60, 128, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Speed", NULL, NULL }, | |
| 7341 | 46 | { jwin_text_proc, 60, 144, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Density", NULL, NULL }, | |
| 7342 | 46 | { jwin_droplist_proc, 144, 100, 96, 16, 0, 0, 0, 0, 0, 0, (void *) &after__list, NULL, NULL }, | |
| 7343 | 46 | { jwin_slider_proc, 144, 128, 116, 8, vc(0), jwin_pal[jcBOX], 0, 0, 6, 0, NULL, NULL, NULL }, | |
| 7344 | 46 | { jwin_slider_proc, 144, 144, 116, 8, vc(0), jwin_pal[jcBOX], 0, 0, 6, 0, NULL, NULL, NULL }, | |
| 7345 | 46 | { jwin_button_proc, 42, 170, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | |
| 7346 | 46 | { jwin_button_proc, 124, 170, 72, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Preview", NULL, NULL }, | |
| 7347 | 46 | { jwin_button_proc, 218, 170, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | |
| 7348 | 46 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 7349 | 46 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | |
| 7350 | }; | ||
| 7351 | |||
| 7352 | ✗ | int32_t onScreenSaver() | |
| 7353 | { | ||
| 7354 | ✗ | scrsaver_dlg[0].dp2=get_zc_font(font_lfont); | |
| 7355 | int32_t oldcfgs[3]; | ||
| 7356 | ✗ | scrsaver_dlg[5].d1 = scrsaver_dlg[5].d2 = oldcfgs[0] = ss_after; | |
| 7357 | ✗ | scrsaver_dlg[6].d2 = oldcfgs[1] = ss_speed; | |
| 7358 | ✗ | scrsaver_dlg[7].d2 = oldcfgs[2] = ss_density; | |
| 7359 | |||
| 7360 | ✗ | large_dialog(scrsaver_dlg); | |
| 7361 | |||
| 7362 | ✗ | int32_t ret = zc_popup_dialog(scrsaver_dlg,-1); | |
| 7363 | |||
| 7364 | ✗ | if(ret == 8 || ret == 9) | |
| 7365 | { | ||
| 7366 | ✗ | ss_after = scrsaver_dlg[5].d1; | |
| 7367 | ✗ | ss_speed = scrsaver_dlg[6].d2; | |
| 7368 | ✗ | ss_density = scrsaver_dlg[7].d2; | |
| 7369 | ✗ | if(oldcfgs[0] != ss_after) | |
| 7370 | ✗ | zc_set_config(cfg_sect,"ss_after",ss_after); | |
| 7371 | ✗ | if(oldcfgs[1] != ss_speed) | |
| 7372 | ✗ | zc_set_config(cfg_sect,"ss_speed",ss_speed); | |
| 7373 | ✗ | if(oldcfgs[2] != ss_density) | |
| 7374 | ✗ | zc_set_config(cfg_sect,"ss_density",ss_density); | |
| 7375 | ✗ | } | |
| 7376 | |||
| 7377 | ✗ | if(ret == 9) | |
| 7378 | // preview Screen Saver | ||
| 7379 | { | ||
| 7380 | ✗ | clear_keybuf(); | |
| 7381 | ✗ | Matrix(ss_speed, ss_density, 30); | |
| 7382 | ✗ | system_pal(true); | |
| 7383 | ✗ | sys_mouse(); | |
| 7384 | ✗ | } | |
| 7385 | |||
| 7386 | ✗ | return D_O_K; | |
| 7387 | } | ||
| 7388 | |||
| 7389 | /***** Menus *****/ | ||
| 7390 | |||
| 7391 | static MENU game_menu[] = | ||
| 7392 | { | ||
| 7393 | { (char *)"&Continue\tESC", onContinue, NULL, 0, NULL }, | ||
| 7394 | { (char *)"", NULL, NULL, 0, NULL }, | ||
| 7395 | { (char *)"L&oad Quest...", onCustomGame, NULL, 0, NULL }, | ||
| 7396 | { (char *)"&End Game\tF6", onTryQuitMenu, NULL, 0, NULL }, | ||
| 7397 | { (char *)"", NULL, NULL, 0, NULL }, | ||
| 7398 | #ifdef __EMSCRIPTEN__ | ||
| 7399 | { (char *)"&Reset\tF7", onReset, NULL, 0, NULL }, | ||
| 7400 | #elif defined(ALLEGRO_MACOSX) | ||
| 7401 | { (char *)"&Reset\tF7", onReset, NULL, 0, NULL }, | ||
| 7402 | { (char *)"&Quit\tF8", onExit, NULL, 0, NULL }, | ||
| 7403 | #else | ||
| 7404 | { (char *)"&Reset\tF9", onReset, NULL, 0, NULL }, | ||
| 7405 | { (char *)"&Quit\tF10", onExit, NULL, 0, NULL }, | ||
| 7406 | #endif | ||
| 7407 | { NULL, NULL, NULL, 0, NULL } | ||
| 7408 | }; | ||
| 7409 | |||
| 7410 | static MENU title_menu[] = | ||
| 7411 | { | ||
| 7412 | { (char *)"&Original", onTitle_NES, NULL, 0, NULL }, | ||
| 7413 | { (char *)"&ZQuest Classic", onTitle_DX, NULL, 0, NULL }, | ||
| 7414 | { (char *)"ZQuest Classic &2.50", onTitle_25, NULL, 0, NULL }, | ||
| 7415 | { NULL, NULL, NULL, 0, NULL } | ||
| 7416 | }; | ||
| 7417 | |||
| 7418 | static MENU snapshot_format_menu[] = | ||
| 7419 | { | ||
| 7420 | { (char *)"&BMP", onSetSnapshotFormat, NULL, 0, NULL }, | ||
| 7421 | { (char *)"&GIF", onSetSnapshotFormat, NULL, 0, NULL }, | ||
| 7422 | { (char *)"&JPG", onSetSnapshotFormat, NULL, 0, NULL }, | ||
| 7423 | { (char *)"&PNG", onSetSnapshotFormat, NULL, 0, NULL }, | ||
| 7424 | { (char *)"PC&X", onSetSnapshotFormat, NULL, 0, NULL }, | ||
| 7425 | { (char *)"&TGA", onSetSnapshotFormat, NULL, 0, NULL }, | ||
| 7426 | { NULL, NULL, NULL, 0, NULL } | ||
| 7427 | }; | ||
| 7428 | |||
| 7429 | static MENU controls_menu[] = | ||
| 7430 | { | ||
| 7431 | { (char *)"Key&board...", onKeyboard, NULL, 0, NULL }, | ||
| 7432 | { (char *)"&Gamepad...", onGamepad, NULL, 0, NULL }, | ||
| 7433 | { (char *)"&Cheat Keys...", onCheatKeys, NULL, 0, NULL }, | ||
| 7434 | { NULL, NULL, NULL, 0, NULL } | ||
| 7435 | }; | ||
| 7436 | |||
| 7437 | static MENU name_entry_mode_menu[] = | ||
| 7438 | { | ||
| 7439 | { (char *)"&Keyboard", onKeyboardEntry, NULL, 0, NULL }, | ||
| 7440 | { (char *)"&Letter Grid", onLetterGridEntry, NULL, 0, NULL }, | ||
| 7441 | { (char *)"&Extended Letter Grid", onExtLetterGridEntry, NULL, 0, NULL }, | ||
| 7442 | { NULL, NULL, NULL, 0, NULL } | ||
| 7443 | }; | ||
| 7444 | |||
| 7445 | static void set_controls_menu_active() | ||
| 7446 | { | ||
| 7447 | |||
| 7448 | } | ||
| 7449 | |||
| 7450 | static MENU window_menu[] = | ||
| 7451 | { | ||
| 7452 | { "Lock Aspect Ratio", onDragAspect, NULL, 0, NULL }, | ||
| 7453 | { "Lock Integer Scale", onIntegerScaling, NULL, 0, NULL }, | ||
| 7454 | { "Save Size Changes", onSaveDragResize, NULL, 0, NULL }, | ||
| 7455 | { "Save Position Changes", onWinPosSave, NULL, 0, NULL }, | ||
| 7456 | { "Stretch Game Area", onStretchGame, NULL, 0, NULL }, | ||
| 7457 | { NULL, NULL, NULL, 0, NULL } | ||
| 7458 | }; | ||
| 7459 | static MENU options_menu[] = | ||
| 7460 | { | ||
| 7461 | { "&Title Screen", NULL, title_menu, 0, NULL }, | ||
| 7462 | { "Name &Entry Mode", NULL, name_entry_mode_menu, 0, NULL }, | ||
| 7463 | { "S&napshot Format", NULL, snapshot_format_menu, 0, NULL }, | ||
| 7464 | { "&Window Settings", NULL, window_menu, 0, NULL }, | ||
| 7465 | { "Epilepsy Flash Reduction", onEpilepsy, NULL, 0, NULL }, | ||
| 7466 | { "Pause In Background", onPauseInBackground, NULL, 0, NULL }, | ||
| 7467 | { NULL, NULL, NULL, 0, NULL } | ||
| 7468 | }; | ||
| 7469 | static MENU settings_menu[] = | ||
| 7470 | { | ||
| 7471 | { "&Sound...", onSound, NULL, 0, NULL }, | ||
| 7472 | { "C&ontrols", NULL, controls_menu, 0, NULL }, | ||
| 7473 | { "", NULL, NULL, 0, NULL }, | ||
| 7474 | { "Options", NULL, options_menu, 0, NULL }, | ||
| 7475 | { "", NULL, NULL, 0, NULL }, | ||
| 7476 | // | ||
| 7477 | { "&Cap FPS\tF1", onVsync, NULL, 0, NULL }, | ||
| 7478 | { "Show &FPS\tF2", onShowFPS, NULL, 0, NULL }, | ||
| 7479 | { "Click to Freeze", onClickToFreeze, NULL, 0, NULL }, | ||
| 7480 | { "Cont. &Heart Beep", onHeartBeep, NULL, 0, NULL }, | ||
| 7481 | { "Show Trans. &Layers", onTransLayers, NULL, 0, NULL }, | ||
| 7482 | // | ||
| 7483 | { "Up+A+B To &Quit", onNESquit, NULL, 0, NULL }, | ||
| 7484 | { "Volume &Keys", onVolKeys, NULL, 0, NULL }, | ||
| 7485 | { "Sa&ve Indicator", onSaveIndicator, NULL, 0, NULL }, | ||
| 7486 | { "", NULL, NULL, 0, NULL }, | ||
| 7487 | { "Debu&g", onDebug, NULL, 0, NULL }, | ||
| 7488 | // | ||
| 7489 | { NULL, NULL, NULL, 0, NULL } | ||
| 7490 | }; | ||
| 7491 | |||
| 7492 | |||
| 7493 | static MENU misc_menu[] = | ||
| 7494 | { | ||
| 7495 | { (char *)"&About...", onAbout, NULL, 0, NULL }, | ||
| 7496 | { (char *)"&Credits...", onCredits, NULL, 0, NULL }, | ||
| 7497 | { (char *)"&Fullscreen", onFullscreenMenu, NULL, 0, NULL }, | ||
| 7498 | { (char *)"&Video Mode...", onVidMode, NULL, 0, NULL }, | ||
| 7499 | { (char *)"", NULL, NULL, 0, NULL }, | ||
| 7500 | //5 | ||
| 7501 | { (char *)"&Quest Info...", onQuest, NULL, 0, NULL }, | ||
| 7502 | { (char *)"Quest &MIDI Info...", onMIDICredits, NULL, 0, NULL }, | ||
| 7503 | { (char *)"Quest &Directory...", onQstPath, NULL, 0, NULL }, | ||
| 7504 | { (char *)"", NULL, NULL, 0, NULL }, | ||
| 7505 | { (char *)"Take &Snapshot\tF12", onSnapshot, NULL, 0, NULL }, | ||
| 7506 | //10 | ||
| 7507 | { (char *)"Sc&reen Saver...", onScreenSaver, NULL, 0, NULL }, | ||
| 7508 | { (char *)"Save ZC Configuration", OnSaveZCConfig, NULL, 0, NULL }, | ||
| 7509 | { (char *)"Show ZASM Debugger", onConsoleZASM, NULL, 0, NULL }, | ||
| 7510 | { (char *)"Show ZScript Debugger", onConsoleZScript, NULL, 0, NULL }, | ||
| 7511 | { (char *)"Clear Console on Qst Load", onClrConsoleOnLoad, NULL, 0, NULL }, | ||
| 7512 | //15 | ||
| 7513 | { (char *)"Clear Directory Cache", OnnClearQuestDir, NULL, 0, NULL }, | ||
| 7514 | { (char *)"Modules", NULL, zcmodule_menu, 0, NULL }, | ||
| 7515 | { NULL, NULL, NULL, 0, NULL } | ||
| 7516 | }; | ||
| 7517 | |||
| 7518 | static MENU refill_menu[] = | ||
| 7519 | { | ||
| 7520 | { (char *)"&Life", onRefillLife, NULL, 0, NULL }, | ||
| 7521 | { (char *)"&Magic", onRefillMagic, NULL, 0, NULL }, | ||
| 7522 | { (char *)"&Bombs", onCheatBombs, NULL, 0, NULL }, | ||
| 7523 | { (char *)"&Rupees", onCheatRupies, NULL, 0, NULL }, | ||
| 7524 | { (char *)"&Arrows", onCheatArrows, NULL, 0, NULL }, | ||
| 7525 | { NULL, NULL, NULL, 0, NULL } | ||
| 7526 | }; | ||
| 7527 | |||
| 7528 | static MENU show_menu[] = | ||
| 7529 | { | ||
| 7530 | { (char *)"Combos", onShowLayer0, NULL, 0, NULL }, | ||
| 7531 | { (char *)"Layer 1", onShowLayer1, NULL, 0, NULL }, | ||
| 7532 | { (char *)"Layer 2", onShowLayer2, NULL, 0, NULL }, | ||
| 7533 | { (char *)"Layer 3", onShowLayer3, NULL, 0, NULL }, | ||
| 7534 | { (char *)"Layer 4", onShowLayer4, NULL, 0, NULL }, | ||
| 7535 | { (char *)"Layer 5", onShowLayer5, NULL, 0, NULL }, | ||
| 7536 | { (char *)"Layer 6", onShowLayer6, NULL, 0, NULL }, | ||
| 7537 | { (char *)"Overhead Combos", onShowLayerO, NULL, 0, NULL }, | ||
| 7538 | { (char *)"Push Blocks", onShowLayerP, NULL, 0, NULL }, | ||
| 7539 | { (char *)"Freeform Combos", onShowLayerF, NULL, 0, NULL }, | ||
| 7540 | { (char *)"Sprites", onShowLayerS, NULL, 0, NULL }, | ||
| 7541 | { (char *)"", NULL, NULL, 0, NULL }, | ||
| 7542 | { (char *)"Current FFC Scripts", onShowFFScripts, NULL, 0, NULL }, | ||
| 7543 | { (char *)"", NULL, NULL, 0, NULL }, | ||
| 7544 | { (char *)"Walkability", onShowLayerW, NULL, 0, NULL }, | ||
| 7545 | { (char *)"Hitboxes", onShowHitboxes, NULL, 0, NULL }, | ||
| 7546 | { (char *)"Effects", onShowLayerE, NULL, 0, NULL }, | ||
| 7547 | { (char *)"Info Opacity", onShowInfoOpacity, NULL, 0, NULL }, | ||
| 7548 | { NULL, NULL, NULL, 0, NULL } | ||
| 7549 | }; | ||
| 7550 | |||
| 7551 | static MENU cheat_menu[] = | ||
| 7552 | { | ||
| 7553 | { (char *)"Set &Cheat", onCheat, NULL, 0, NULL }, | ||
| 7554 | { (char *)"", NULL, NULL, 0, NULL }, | ||
| 7555 | { (char *)"Re&fill", NULL, refill_menu, 0, NULL }, | ||
| 7556 | { (char *)"", NULL, NULL, 0, NULL }, | ||
| 7557 | { (char *)"&Invincible", onClock, NULL, 0, NULL }, | ||
| 7558 | { (char *)"Ma&x Bombs...", onMaxBombs, NULL, 0, NULL }, | ||
| 7559 | { (char *)"&Heart Containers...", onHeartC, NULL, 0, NULL }, | ||
| 7560 | { (char *)"&Magic Containers...", onMagicC, NULL, 0, NULL }, | ||
| 7561 | { (char *)"", NULL, NULL, 0, NULL }, | ||
| 7562 | { (char *)"&Player Data...", onCheatConsole, NULL, 0, NULL }, | ||
| 7563 | { (char *)"", NULL, NULL, 0, NULL }, | ||
| 7564 | { (char *)"Walk Through &Walls", onNoWalls, NULL, 0, NULL }, | ||
| 7565 | { (char *)"Player Ignores Side&view", onIgnoreSideview, NULL, 0, NULL }, | ||
| 7566 | { (char *)"&Quick Movement", onGoFast, NULL, 0, NULL }, | ||
| 7567 | { (char *)"&Kill All Enemies", onKillCheat, NULL, 0, NULL }, | ||
| 7568 | { (char *)"Trigger &Secrets", onSecretsCheat, NULL, 0, NULL }, | ||
| 7569 | { (char *)"Trigger Secrets Perm", onSecretsCheatPerm, NULL, 0, NULL }, | ||
| 7570 | { (char *)"Show/Hide Layer", NULL, show_menu, 0, NULL }, | ||
| 7571 | { (char *)"Toggle &Light", onLightSwitch, NULL, 0, NULL }, | ||
| 7572 | { (char *)"&Goto Location...", onGoTo, NULL, 0, NULL }, | ||
| 7573 | { NULL, NULL, NULL, 0, NULL } | ||
| 7574 | }; | ||
| 7575 | |||
| 7576 | #if DEVLEVEL > 0 | ||
| 7577 | int32_t devLogging(); | ||
| 7578 | int32_t devDebug(); | ||
| 7579 | int32_t devTimestmp(); | ||
| 7580 | #if DEVLEVEL > 1 | ||
| 7581 | int32_t setCheat(); | ||
| 7582 | #endif //DEVLEVEL > 1 | ||
| 7583 | enum | ||
| 7584 | { | ||
| 7585 | dv_log, | ||
| 7586 | // dv_dbg, | ||
| 7587 | dv_tmpstmp, | ||
| 7588 | #if DEVLEVEL > 1 | ||
| 7589 | dv_nil, | ||
| 7590 | dv_setcheat, | ||
| 7591 | #endif //DEVLEVEL > 1 | ||
| 7592 | dv_max | ||
| 7593 | }; | ||
| 7594 | static MENU dev_menu[] = | ||
| 7595 | { | ||
| 7596 | { (char *)"&Force Error Log", devLogging, NULL, 0, NULL }, | ||
| 7597 | // { (char *)"&Extra Debug Log", devDebug, NULL, 0, NULL }, | ||
| 7598 | { (char *)"&Timestamp Log", devTimestmp, NULL, 0, NULL }, | ||
| 7599 | #if DEVLEVEL > 1 | ||
| 7600 | { (char *)"", NULL, NULL, 0, NULL }, | ||
| 7601 | { (char *)"Set &Cheat", setCheat, NULL, 0, NULL }, | ||
| 7602 | #endif //DEVLEVEL > 1 | ||
| 7603 | { NULL, NULL, NULL, 0, NULL } | ||
| 7604 | }; | ||
| 7605 | int32_t devLogging() | ||
| 7606 | { | ||
| 7607 | dev_logging = !dev_logging; | ||
| 7608 | dev_menu[dv_log].flags = dev_logging ? D_SELECTED : 0; | ||
| 7609 | return D_O_K; | ||
| 7610 | } | ||
| 7611 | // int32_t devDebug() | ||
| 7612 | // { | ||
| 7613 | // dev_debug = !dev_debug; | ||
| 7614 | // dev_menu[dv_dbg].flags = dev_debug ? D_SELECTED : 0; | ||
| 7615 | // return D_O_K; | ||
| 7616 | // } | ||
| 7617 | int32_t devTimestmp() | ||
| 7618 | { | ||
| 7619 | dev_timestmp = !dev_timestmp; | ||
| 7620 | dev_menu[dv_tmpstmp].flags = dev_timestmp ? D_SELECTED : 0; | ||
| 7621 | return D_O_K; | ||
| 7622 | } | ||
| 7623 | #if DEVLEVEL > 1 | ||
| 7624 | int32_t setCheat() | ||
| 7625 | { | ||
| 7626 | cheat = (vbound(getnumber("Cheat Level",cheat), 0, 4)); | ||
| 7627 | return D_O_K; | ||
| 7628 | } | ||
| 7629 | #endif //DEVLEVEL > 1 | ||
| 7630 | #endif //DEVLEVEL > 0 | ||
| 7631 | |||
| 7632 | MENU the_player_menu[] = | ||
| 7633 | { | ||
| 7634 | { (char *)"&Game", NULL, game_menu, 0, NULL }, | ||
| 7635 | { (char *)"&Settings", NULL, settings_menu, 0, NULL }, | ||
| 7636 | { (char *)"&Cheat", NULL, cheat_menu, 0, NULL }, | ||
| 7637 | { (char *)"Replay", NULL, replay_menu, 0, NULL }, | ||
| 7638 | { (char *)"&ZC", NULL, misc_menu, 0, NULL }, | ||
| 7639 | #if DEVLEVEL > 0 | ||
| 7640 | { (char *)"&Dev", NULL, dev_menu, 0, NULL }, | ||
| 7641 | #endif | ||
| 7642 | { NULL, NULL, NULL, 0, NULL } | ||
| 7643 | }; | ||
| 7644 | ✗ | int32_t onPauseInBackground() | |
| 7645 | { | ||
| 7646 | ✗ | if(jwin_alert3( | |
| 7647 | "Toggle Pause In Background", | ||
| 7648 | "This action will change whether ZC Player pauses when the window loses focus.", | ||
| 7649 | "", | ||
| 7650 | "Proceed?", | ||
| 7651 | "&Yes", | ||
| 7652 | "&No", | ||
| 7653 | NULL, | ||
| 7654 | 'y', | ||
| 7655 | 'n', | ||
| 7656 | 0, | ||
| 7657 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 7658 | { | ||
| 7659 | ✗ | pause_in_background = pause_in_background ? 0 : 1; | |
| 7660 | ✗ | zc_set_config("zeldadx","pause_in_background", pause_in_background); | |
| 7661 | ✗ | int switch_type = pause_in_background ? SWITCH_PAUSE : SWITCH_BACKGROUND; | |
| 7662 | ✗ | set_display_switch_mode(fullscreen?SWITCH_BACKAMNESIA:switch_type); | |
| 7663 | ✗ | set_display_switch_callback(SWITCH_OUT, switch_out_callback); | |
| 7664 | ✗ | set_display_switch_callback(SWITCH_IN, switch_in_callback); | |
| 7665 | ✗ | } | |
| 7666 | ✗ | options_menu[5].flags =(pause_in_background)?D_SELECTED:0; | |
| 7667 | ✗ | return D_O_K; | |
| 7668 | } | ||
| 7669 | |||
| 7670 | ✗ | int32_t onKeyboardEntry() | |
| 7671 | { | ||
| 7672 | ✗ | NameEntryMode=0; | |
| 7673 | ✗ | zc_set_config(cfg_sect,"name_entry_mode",NameEntryMode); | |
| 7674 | ✗ | return D_O_K; | |
| 7675 | } | ||
| 7676 | |||
| 7677 | ✗ | int32_t onLetterGridEntry() | |
| 7678 | { | ||
| 7679 | ✗ | NameEntryMode=1; | |
| 7680 | ✗ | zc_set_config(cfg_sect,"name_entry_mode",NameEntryMode); | |
| 7681 | ✗ | return D_O_K; | |
| 7682 | } | ||
| 7683 | |||
| 7684 | ✗ | int32_t onExtLetterGridEntry() | |
| 7685 | { | ||
| 7686 | ✗ | NameEntryMode=2; | |
| 7687 | ✗ | zc_set_config(cfg_sect,"name_entry_mode",NameEntryMode); | |
| 7688 | ✗ | return D_O_K; | |
| 7689 | } | ||
| 7690 | |||
| 7691 | static BITMAP* oldscreen; | ||
| 7692 | ✗ | int32_t onFullscreenMenu() | |
| 7693 | { | ||
| 7694 | // super hacks | ||
| 7695 | ✗ | screen = oldscreen; | |
| 7696 | ✗ | if (onFullscreen() == D_REDRAW) | |
| 7697 | { | ||
| 7698 | ✗ | oldscreen = screen; | |
| 7699 | ✗ | } | |
| 7700 | ✗ | screen = menu_bmp; | |
| 7701 | ✗ | misc_menu[2].flags =(isFullScreen()==1)?D_SELECTED:0; | |
| 7702 | ✗ | return D_O_K; | |
| 7703 | } | ||
| 7704 | |||
| 7705 | 46 | void fix_menu() | |
| 7706 | { | ||
| 7707 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
|
46 | if(!debug_enabled) |
| 7708 | 46 | settings_menu[13].text = NULL; | |
| 7709 | 46 | } | |
| 7710 | |||
| 7711 | static DIALOG system_dlg[] = | ||
| 7712 | { | ||
| 7713 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) */ | ||
| 7714 | { jwin_menu_proc, 0, 0, 0, 0, 0, 0, 0, D_USER, 0, 0, (void *) the_player_menu, NULL, NULL }, | ||
| 7715 | { d_keyboard_proc, 0, 0, 0, 0, 0, 0, 0, 0, KEY_F1, 0, (void *) onVsync, NULL, NULL }, | ||
| 7716 | { d_keyboard_proc, 0, 0, 0, 0, 0, 0, 0, 0, KEY_F2, 0, (void *) onShowFPS, NULL, NULL }, | ||
| 7717 | { d_keyboard_proc, 0, 0, 0, 0, 0, 0, 0, 0, KEY_F6, 0, (void *) onTryQuitMenu, NULL, NULL }, | ||
| 7718 | #ifndef ALLEGRO_MACOSX | ||
| 7719 | { d_keyboard_proc, 0, 0, 0, 0, 0, 0, 0, 0, KEY_F9, 0, (void *) onReset, NULL, NULL }, | ||
| 7720 | { d_keyboard_proc, 0, 0, 0, 0, 0, 0, 0, 0, KEY_F10, 0, (void *) onExit, NULL, NULL }, | ||
| 7721 | #else | ||
| 7722 | { d_keyboard_proc, 0, 0, 0, 0, 0, 0, 0, 0, KEY_F7, 0, (void *) onReset, NULL, NULL }, | ||
| 7723 | { d_keyboard_proc, 0, 0, 0, 0, 0, 0, 0, 0, KEY_F8, 0, (void *) onExit, NULL, NULL }, | ||
| 7724 | #endif | ||
| 7725 | { d_keyboard_proc, 0, 0, 0, 0, 0, 0, 0, 0, KEY_F12, 0, (void *) onSnapshot, NULL, NULL }, | ||
| 7726 | { d_keyboard_proc, 0, 0, 0, 0, 0, 0, 0, 0, KEY_TAB, 0, (void *) onDebug, NULL, NULL }, | ||
| 7727 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 7728 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 7729 | }; | ||
| 7730 | |||
| 7731 | ✗ | void reset_snapshot_format_menu() | |
| 7732 | { | ||
| 7733 | ✗ | for(int32_t i=0; i<ssfmtMAX; ++i) | |
| 7734 | { | ||
| 7735 | ✗ | snapshot_format_menu[i].flags=0; | |
| 7736 | ✗ | } | |
| 7737 | ✗ | } | |
| 7738 | |||
| 7739 | ✗ | int32_t onSetSnapshotFormat() | |
| 7740 | { | ||
| 7741 | ✗ | switch(active_menu->text[1]) | |
| 7742 | { | ||
| 7743 | case 'B': //"&BMP" | ||
| 7744 | ✗ | SnapshotFormat=0; | |
| 7745 | ✗ | break; | |
| 7746 | |||
| 7747 | case 'G': //"&GIF" | ||
| 7748 | ✗ | SnapshotFormat=1; | |
| 7749 | ✗ | break; | |
| 7750 | |||
| 7751 | case 'J': //"&JPG" | ||
| 7752 | ✗ | SnapshotFormat=2; | |
| 7753 | ✗ | break; | |
| 7754 | |||
| 7755 | case 'P': //"&PNG" | ||
| 7756 | ✗ | SnapshotFormat=3; | |
| 7757 | ✗ | break; | |
| 7758 | |||
| 7759 | case 'C': //"PC&X" | ||
| 7760 | ✗ | SnapshotFormat=4; | |
| 7761 | ✗ | break; | |
| 7762 | |||
| 7763 | case 'T': //"&TGA" | ||
| 7764 | ✗ | SnapshotFormat=5; | |
| 7765 | ✗ | break; | |
| 7766 | |||
| 7767 | case 'L': //"&LBM" | ||
| 7768 | ✗ | SnapshotFormat=6; | |
| 7769 | ✗ | break; | |
| 7770 | } | ||
| 7771 | ✗ | zc_set_config("zeldadx", "snapshot_format", SnapshotFormat); | |
| 7772 | |||
| 7773 | ✗ | snapshot_format_menu[SnapshotFormat].flags=D_SELECTED; | |
| 7774 | ✗ | return D_O_K; | |
| 7775 | } | ||
| 7776 | |||
| 7777 | |||
| 7778 | ✗ | void color_layer(RGB *src,RGB *dest,char r,char g,char b,char pos,int32_t from,int32_t to) | |
| 7779 | { | ||
| 7780 | PALETTE tmp; | ||
| 7781 | |||
| 7782 | ✗ | for(int32_t i=0; i<256; i++) | |
| 7783 | { | ||
| 7784 | ✗ | tmp[i].r=r; | |
| 7785 | ✗ | tmp[i].g=g; | |
| 7786 | ✗ | tmp[i].b=b; | |
| 7787 | ✗ | } | |
| 7788 | |||
| 7789 | ✗ | fade_interpolate(src,tmp,dest,pos,from,to); | |
| 7790 | ✗ | } | |
| 7791 | |||
| 7792 | 13 | void system_pal(bool force) | |
| 7793 | { | ||
| 7794 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13 | if(is_sys_pal && !force) return; |
| 7795 | 13 | is_sys_pal = true; | |
| 7796 | 13 | load_colorset(gui_colorset, syspal, jwin_a5_colors); | |
| 7797 | 13 | hw_palette = &syspal; | |
| 7798 | 13 | update_hw_pal = true; | |
| 7799 | 13 | } | |
| 7800 | |||
| 7801 | static uint32_t entered_sys_pal = 0; | ||
| 7802 | 13 | void enter_sys_pal() | |
| 7803 | { | ||
| 7804 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if(is_sys_pal) |
| 7805 | { | ||
| 7806 | ✗ | if(entered_sys_pal) | |
| 7807 | ✗ | ++entered_sys_pal; | |
| 7808 | ✗ | return; | |
| 7809 | } | ||
| 7810 | 13 | sys_mouse(); | |
| 7811 | 13 | system_pal(true); | |
| 7812 | 13 | ++entered_sys_pal; | |
| 7813 | 13 | } | |
| 7814 | 13 | void exit_sys_pal() | |
| 7815 | { | ||
| 7816 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if(entered_sys_pal) |
| 7817 | { | ||
| 7818 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if(!--entered_sys_pal) |
| 7819 | { | ||
| 7820 | 13 | game_pal(); | |
| 7821 | 13 | game_mouse(); | |
| 7822 | 13 | } | |
| 7823 | 13 | } | |
| 7824 | 13 | } | |
| 7825 | |||
| 7826 | ✗ | void switch_out_callback() | |
| 7827 | { | ||
| 7828 | ✗ | if (pause_in_background && !MenuOpen) | |
| 7829 | { | ||
| 7830 | ✗ | System(); | |
| 7831 | ✗ | } | |
| 7832 | ✗ | } | |
| 7833 | |||
| 7834 | ✗ | void switch_in_callback() | |
| 7835 | { | ||
| 7836 | ✗ | } | |
| 7837 | |||
| 7838 | 421 | void game_pal() | |
| 7839 | { | ||
| 7840 | 421 | is_sys_pal = false; | |
| 7841 | 421 | entered_sys_pal = 0; | |
| 7842 | 421 | hw_palette = &RAMpal; | |
| 7843 | 421 | update_hw_pal = true; | |
| 7844 | 421 | } | |
| 7845 | |||
| 7846 | static char bar_str[] = ""; | ||
| 7847 | |||
| 7848 | 13 | void music_pause() | |
| 7849 | { | ||
| 7850 | //al_pause_duh(tmplayer); | ||
| 7851 | 13 | zcmusic_pause(zcmusic, ZCM_PAUSE); | |
| 7852 | 13 | zc_midi_pause(); | |
| 7853 | 13 | } | |
| 7854 | |||
| 7855 | ✗ | void music_resume() | |
| 7856 | { | ||
| 7857 | //al_resume_duh(tmplayer); | ||
| 7858 | ✗ | zcmusic_pause(zcmusic, ZCM_RESUME); | |
| 7859 | ✗ | zc_midi_resume(); | |
| 7860 | ✗ | } | |
| 7861 | |||
| 7862 | 3358 | void music_stop() | |
| 7863 | { | ||
| 7864 | //al_stop_duh(tmplayer); | ||
| 7865 | //unload_duh(tmusic); | ||
| 7866 | //tmusic=NULL; | ||
| 7867 | //tmplayer=NULL; | ||
| 7868 | 3358 | zcmusic_stop(zcmusic); | |
| 7869 | 3358 | zcmusic_unload_file(zcmusic); | |
| 7870 | 3358 | zc_stop_midi(); | |
| 7871 | 3358 | currmidi=-1; | |
| 7872 | 3358 | } | |
| 7873 | |||
| 7874 | ✗ | void System() | |
| 7875 | { | ||
| 7876 | ✗ | mouse_down=gui_mouse_b(); | |
| 7877 | ✗ | music_pause(); | |
| 7878 | ✗ | pause_all_sfx(); | |
| 7879 | ✗ | MenuOpen = true; | |
| 7880 | ✗ | enter_sys_pal(); | |
| 7881 | // FONT *oldfont=font; | ||
| 7882 | // font=tfont; | ||
| 7883 | |||
| 7884 | ✗ | misc_menu[2].flags =(isFullScreen()==1)?D_SELECTED:0; | |
| 7885 | ✗ | misc_menu[3].flags =(isFullScreen()==1)?D_DISABLED:0; | |
| 7886 | |||
| 7887 | ✗ | game_menu[2].flags = getsaveslot() > -1 ? 0 : D_DISABLED; | |
| 7888 | #if DEVLEVEL > 1 | ||
| 7889 | dev_menu[dv_setcheat].flags = Playing ? 0 : D_DISABLED; | ||
| 7890 | #endif | ||
| 7891 | ✗ | game_menu[3].flags = | |
| 7892 | ✗ | misc_menu[5].flags = Playing ? 0 : D_DISABLED; | |
| 7893 | ✗ | misc_menu[7].flags = !Playing ? 0 : D_DISABLED; | |
| 7894 | ✗ | clear_keybuf(); | |
| 7895 | |||
| 7896 | DIALOG_PLAYER *p; | ||
| 7897 | |||
| 7898 | ✗ | clear_bitmap(menu_bmp); | |
| 7899 | ✗ | oldscreen = screen; | |
| 7900 | ✗ | screen = menu_bmp; | |
| 7901 | |||
| 7902 | ✗ | p = init_dialog(system_dlg,-1); | |
| 7903 | |||
| 7904 | // drop the menu on startup if menu button pressed | ||
| 7905 | ✗ | if(joybtn(Mbtn)||zc_getrawkey(KEY_ESC)) | |
| 7906 | ✗ | simulate_keypress(KEY_G << 8); | |
| 7907 | |||
| 7908 | ✗ | do | |
| 7909 | { | ||
| 7910 | ✗ | if(close_button_quit) | |
| 7911 | { | ||
| 7912 | ✗ | close_button_quit = false; | |
| 7913 | ✗ | f_Quit(qEXIT); | |
| 7914 | ✗ | if(Quit) break; | |
| 7915 | ✗ | } | |
| 7916 | ✗ | rest(17); | |
| 7917 | |||
| 7918 | ✗ | if(mouse_down && !gui_mouse_b()) | |
| 7919 | ✗ | mouse_down=0; | |
| 7920 | |||
| 7921 | ✗ | title_menu[0].flags = (title_version==0) ? D_SELECTED : 0; | |
| 7922 | ✗ | title_menu[1].flags = (title_version==1) ? D_SELECTED : 0; | |
| 7923 | ✗ | title_menu[2].flags = (title_version==2) ? D_SELECTED : 0; | |
| 7924 | |||
| 7925 | ✗ | settings_menu[1].flags = replay_is_replaying() ? D_DISABLED : 0; | |
| 7926 | ✗ | settings_menu[5].flags = Throttlefps?D_SELECTED:0; | |
| 7927 | ✗ | settings_menu[6].flags = ShowFPS?D_SELECTED:0; | |
| 7928 | ✗ | settings_menu[7].flags = ClickToFreeze?D_SELECTED:0; | |
| 7929 | ✗ | settings_menu[9].flags = TransLayers?D_SELECTED:0; | |
| 7930 | ✗ | settings_menu[10].flags = NESquit?D_SELECTED:0; | |
| 7931 | ✗ | settings_menu[11].flags = volkeys?D_SELECTED:0; | |
| 7932 | |||
| 7933 | ✗ | window_menu[0].flags = DragAspect?D_SELECTED:0; | |
| 7934 | ✗ | window_menu[1].flags = scaleForceInteger?D_SELECTED:0; | |
| 7935 | ✗ | window_menu[2].flags = SaveDragResize?D_SELECTED:0; | |
| 7936 | ✗ | window_menu[3].flags = SaveWinPos?D_SELECTED:0; | |
| 7937 | ✗ | window_menu[4].flags = stretchGame?D_SELECTED:0; | |
| 7938 | |||
| 7939 | ✗ | options_menu[4].flags = (epilepsyFlashReduction) ? D_SELECTED : 0; | |
| 7940 | ✗ | options_menu[5].flags = (pause_in_background)?D_SELECTED:0; | |
| 7941 | |||
| 7942 | ✗ | name_entry_mode_menu[0].flags = (NameEntryMode==0)?D_SELECTED:0; | |
| 7943 | ✗ | name_entry_mode_menu[1].flags = (NameEntryMode==1)?D_SELECTED:0; | |
| 7944 | ✗ | name_entry_mode_menu[2].flags = (NameEntryMode==2)?D_SELECTED:0; | |
| 7945 | |||
| 7946 | ✗ | misc_menu[12].flags =(zasm_debugger)?D_SELECTED:0; | |
| 7947 | ✗ | misc_menu[13].flags =(zscript_debugger)?D_SELECTED:0; | |
| 7948 | ✗ | misc_menu[14].flags =(clearConsoleOnLoad)?D_SELECTED:0; | |
| 7949 | |||
| 7950 | ✗ | bool nocheat = (replay_is_replaying() || !Playing | |
| 7951 | ✗ | || (!zcheats.flags && !get_debug() && DEVLEVEL < 2 && !zqtesting_mode && !devpwd())); | |
| 7952 | ✗ | the_player_menu[2].flags = nocheat ? D_DISABLED : 0; | |
| 7953 | ✗ | cheat_menu[0].flags = 0; | |
| 7954 | ✗ | refill_menu[4].flags = get_qr(qr_TRUEARROWS) ? 0 : D_DISABLED; | |
| 7955 | ✗ | cheat_menu[1].text = (cheat >= 1) || get_debug() ? bar_str : NULL; | |
| 7956 | ✗ | cheat_menu[3].text = (cheat >= 2) || get_debug() ? bar_str : NULL; | |
| 7957 | ✗ | cheat_menu[8].text = (cheat >= 3) || get_debug() ? bar_str : NULL; | |
| 7958 | ✗ | cheat_menu[10].text = (cheat >= 4) || get_debug() ? bar_str : NULL; | |
| 7959 | ✗ | cheat_menu[4].flags = getClock() ? D_SELECTED : 0; | |
| 7960 | ✗ | cheat_menu[11].flags = toogam ? D_SELECTED : 0; | |
| 7961 | ✗ | cheat_menu[12].flags = ignoreSideview ? D_SELECTED : 0; | |
| 7962 | ✗ | cheat_menu[13].flags = gofast ? D_SELECTED : 0; | |
| 7963 | |||
| 7964 | ✗ | show_menu[0].flags = show_layer_0 ? D_SELECTED : 0; | |
| 7965 | ✗ | show_menu[1].flags = show_layer_1 ? D_SELECTED : 0; | |
| 7966 | ✗ | show_menu[2].flags = show_layer_2 ? D_SELECTED : 0; | |
| 7967 | ✗ | show_menu[3].flags = show_layer_3 ? D_SELECTED : 0; | |
| 7968 | ✗ | show_menu[4].flags = show_layer_4 ? D_SELECTED : 0; | |
| 7969 | ✗ | show_menu[5].flags = show_layer_5 ? D_SELECTED : 0; | |
| 7970 | ✗ | show_menu[6].flags = show_layer_6 ? D_SELECTED : 0; | |
| 7971 | ✗ | show_menu[7].flags = show_layer_over ? D_SELECTED : 0; | |
| 7972 | ✗ | show_menu[8].flags = show_layer_push ? D_SELECTED : 0; | |
| 7973 | ✗ | show_menu[9].flags = show_sprites ? D_SELECTED : 0; | |
| 7974 | ✗ | show_menu[10].flags = show_ffcs ? D_SELECTED : 0; | |
| 7975 | ✗ | show_menu[12].flags = show_walkflags ? D_SELECTED : 0; | |
| 7976 | ✗ | show_menu[13].flags = show_ff_scripts ? D_SELECTED : 0; | |
| 7977 | ✗ | show_menu[14].flags = show_hitboxes ? D_SELECTED : 0; | |
| 7978 | ✗ | show_menu[15].flags = show_effectflags ? D_SELECTED : 0; | |
| 7979 | |||
| 7980 | ✗ | settings_menu[8].flags = heart_beep ? D_SELECTED : 0; | |
| 7981 | ✗ | settings_menu[12].flags = use_save_indicator ? D_SELECTED : 0; | |
| 7982 | |||
| 7983 | ✗ | replay_menu[0].text = zc_get_config("zeldadx", "replay_new_saves", false) ? | |
| 7984 | (char *)"Disable recording new saves" : | ||
| 7985 | (char *)"Enable recording new saves"; | ||
| 7986 | ✗ | replay_menu[1].flags = replay_is_active() ? 0 : D_DISABLED; | |
| 7987 | ✗ | replay_menu[1].text = replay_get_mode() == ReplayMode::Record ? | |
| 7988 | (char *)"Stop recording" : | ||
| 7989 | (char *)"Stop replaying"; | ||
| 7990 | ✗ | replay_menu[5].flags = replay_get_mode() == ReplayMode::Record ? 0 : D_DISABLED; | |
| 7991 | ✗ | replay_menu[6].text = replay_is_snapshot_all_frames() ? | |
| 7992 | (char *)"Disable snapshot all frames" : | ||
| 7993 | (char *)"Enable snapshot all frames"; | ||
| 7994 | |||
| 7995 | ✗ | reset_snapshot_format_menu(); | |
| 7996 | ✗ | snapshot_format_menu[SnapshotFormat].flags = D_SELECTED; | |
| 7997 | |||
| 7998 | ✗ | if(debug_enabled) | |
| 7999 | { | ||
| 8000 | ✗ | settings_menu[14].flags = get_debug() ? D_SELECTED : 0; | |
| 8001 | ✗ | } | |
| 8002 | |||
| 8003 | ✗ | if(gui_mouse_b() && !mouse_down) | |
| 8004 | ✗ | break; | |
| 8005 | |||
| 8006 | // press menu to drop the menu | ||
| 8007 | ✗ | if(rMbtn()) | |
| 8008 | ✗ | simulate_keypress(KEY_G << 8); | |
| 8009 | |||
| 8010 | ✗ | if(input_idle(true) > after_time()) | |
| 8011 | // run Screeen Saver | ||
| 8012 | { | ||
| 8013 | // Screen saver enabled for now. | ||
| 8014 | ✗ | clear_keybuf(); | |
| 8015 | ✗ | Matrix(ss_speed, ss_density, 0); | |
| 8016 | ✗ | system_pal(true); | |
| 8017 | ✗ | sys_mouse(); | |
| 8018 | ✗ | broadcast_dialog_message(MSG_DRAW, 0); | |
| 8019 | ✗ | } | |
| 8020 | |||
| 8021 | ✗ | update_hw_screen(); | |
| 8022 | ✗ | } | |
| 8023 | ✗ | while(update_dialog(p)); | |
| 8024 | |||
| 8025 | ✗ | screen = oldscreen; | |
| 8026 | |||
| 8027 | // font=oldfont; | ||
| 8028 | ✗ | mouse_down=gui_mouse_b(); | |
| 8029 | ✗ | shutdown_dialog(p); | |
| 8030 | ✗ | MenuOpen = false; | |
| 8031 | ✗ | if(Quit) | |
| 8032 | { | ||
| 8033 | ✗ | kill_sfx(); | |
| 8034 | ✗ | music_stop(); | |
| 8035 | ✗ | update_hw_screen(); | |
| 8036 | ✗ | } | |
| 8037 | else | ||
| 8038 | { | ||
| 8039 | ✗ | music_resume(); | |
| 8040 | ✗ | resume_all_sfx(); | |
| 8041 | |||
| 8042 | ✗ | if(rc) | |
| 8043 | ✗ | ringcolor(false); | |
| 8044 | } | ||
| 8045 | ✗ | exit_sys_pal(); | |
| 8046 | |||
| 8047 | ✗ | eat_buttons(); | |
| 8048 | |||
| 8049 | ✗ | rc=false; | |
| 8050 | ✗ | clear_keybuf(); | |
| 8051 | // text_mode(0); | ||
| 8052 | ✗ | } | |
| 8053 | |||
| 8054 | 46 | void fix_dialogs() | |
| 8055 | { | ||
| 8056 | 46 | jwin_center_dialog(about_dlg); | |
| 8057 | 46 | jwin_center_dialog(gamepad_dlg); | |
| 8058 | 46 | jwin_center_dialog(credits_dlg); | |
| 8059 | 46 | jwin_center_dialog(gamemode_dlg); | |
| 8060 | 46 | jwin_center_dialog(getnum_dlg); | |
| 8061 | 46 | jwin_center_dialog(goto_dlg); | |
| 8062 | 46 | jwin_center_dialog(keyboard_control_dlg); | |
| 8063 | 46 | jwin_center_dialog(midi_dlg); | |
| 8064 | 46 | jwin_center_dialog(quest_dlg); | |
| 8065 | 46 | jwin_center_dialog(scrsaver_dlg); | |
| 8066 | 46 | jwin_center_dialog(sound_dlg); | |
| 8067 | 46 | jwin_center_dialog(triforce_dlg); | |
| 8068 | |||
| 8069 | // digi_dp[1] += scrx; | ||
| 8070 | // digi_dp[2] += scry; | ||
| 8071 | // midi_dp[1] += scrx; | ||
| 8072 | // midi_dp[2] += scry; | ||
| 8073 | // pan_dp[1] += scrx; | ||
| 8074 | // pan_dp[2] += scry; | ||
| 8075 | // emus_dp[1] += scrx; | ||
| 8076 | // emus_dp[2] += scry; | ||
| 8077 | // buf_dp[1] += scrx; | ||
| 8078 | // buf_dp[2] += scry; | ||
| 8079 | // sfx_dp[1] += scrx; | ||
| 8080 | // sfx_dp[2] += scry; | ||
| 8081 | 46 | } | |
| 8082 | |||
| 8083 | /*****************************/ | ||
| 8084 | /**** Custom Sound System ****/ | ||
| 8085 | /*****************************/ | ||
| 8086 | |||
| 8087 | 46 | INLINE int32_t mixvol(int32_t v1,int32_t v2) | |
| 8088 | { | ||
| 8089 |
2/4✓ Branch 0 taken 46 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 46 times.
✗ Branch 3 not taken.
|
46 | return (zc_min(v1,255)*zc_min(v2,255)) >> 8; |
| 8090 | } | ||
| 8091 | |||
| 8092 | // Run an NSF, or a MIDI if the NSF is missing somehow. | ||
| 8093 | 149 | bool try_zcmusic(char *filename, int32_t track, int32_t midi) | |
| 8094 | { | ||
| 8095 | 149 | ZCMUSIC *newzcmusic = zcmusic_load_for_quest(filename, qstpath); | |
| 8096 | |||
| 8097 | // Found it | ||
| 8098 |
2/2✓ Branch 0 taken 70 times.
✓ Branch 1 taken 79 times.
|
149 | if(newzcmusic!=NULL) |
| 8099 | { | ||
| 8100 | 70 | zcmusic_stop(zcmusic); | |
| 8101 | 70 | zcmusic_unload_file(zcmusic); | |
| 8102 | 70 | zc_stop_midi(); | |
| 8103 | |||
| 8104 | 70 | zcmusic=newzcmusic; | |
| 8105 | 70 | zcmusic_play(zcmusic, emusic_volume); | |
| 8106 | |||
| 8107 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
|
70 | if(track>0) |
| 8108 | 70 | zcmusic_change_track(zcmusic,track); | |
| 8109 | |||
| 8110 | 70 | return true; | |
| 8111 | } | ||
| 8112 | |||
| 8113 | // Not found, play MIDI - unless this was called by a script (yay, magic numbers) | ||
| 8114 |
1/2✓ Branch 0 taken 79 times.
✗ Branch 1 not taken.
|
79 | else if(midi>-1000) |
| 8115 | ✗ | jukebox(midi); | |
| 8116 | |||
| 8117 | 79 | return false; | |
| 8118 | 149 | } | |
| 8119 | |||
| 8120 | ✗ | bool try_zcmusic_ex(char *filename, int32_t track, int32_t midi) | |
| 8121 | { | ||
| 8122 | ✗ | ZCMUSIC *newzcmusic = zcmusic_load_for_quest(filename, qstpath); | |
| 8123 | // Found it | ||
| 8124 | ✗ | if(newzcmusic!=NULL) | |
| 8125 | { | ||
| 8126 | ✗ | zcmusic_stop(zcmusic); | |
| 8127 | ✗ | zcmusic_unload_file(zcmusic); | |
| 8128 | ✗ | zc_stop_midi(); | |
| 8129 | |||
| 8130 | ✗ | zcmusic=newzcmusic; | |
| 8131 | ✗ | zcmusic_play(zcmusic, emusic_volume); | |
| 8132 | |||
| 8133 | ✗ | if(track>0) | |
| 8134 | ✗ | zcmusic_change_track(zcmusic,track); | |
| 8135 | |||
| 8136 | ✗ | return true; | |
| 8137 | } | ||
| 8138 | |||
| 8139 | // Not found, play MIDI - unless this was called by a script (yay, magic numbers) | ||
| 8140 | ✗ | else if(midi>-1000) | |
| 8141 | ✗ | jukebox(midi); | |
| 8142 | |||
| 8143 | ✗ | return false; | |
| 8144 | ✗ | } | |
| 8145 | |||
| 8146 | ✗ | int32_t get_zcmusicpos() | |
| 8147 | { | ||
| 8148 | ✗ | int32_t debugtracething = zcmusic_get_curpos(zcmusic); | |
| 8149 | ✗ | return debugtracething; | |
| 8150 | return 0; | ||
| 8151 | } | ||
| 8152 | |||
| 8153 | ✗ | void set_zcmusicpos(int32_t position) | |
| 8154 | { | ||
| 8155 | ✗ | zcmusic_set_curpos(zcmusic, position); | |
| 8156 | ✗ | } | |
| 8157 | |||
| 8158 | ✗ | void set_zcmusicspeed(int32_t speed) | |
| 8159 | { | ||
| 8160 | ✗ | int32_t newspeed = vbound(speed, 0, 10000); | |
| 8161 | ✗ | zcmusic_set_speed(zcmusic, newspeed); | |
| 8162 | ✗ | } | |
| 8163 | |||
| 8164 | 63871 | void jukebox(int32_t index,int32_t loop) | |
| 8165 | { | ||
| 8166 |
1/2✓ Branch 0 taken 63871 times.
✗ Branch 1 not taken.
|
63871 | if (is_headless()) |
| 8167 | 63871 | return; | |
| 8168 | |||
| 8169 | ✗ | music_stop(); | |
| 8170 | |||
| 8171 | ✗ | if(index<0) index=MAXMIDIS-1; | |
| 8172 | |||
| 8173 | ✗ | if(index>=MAXMIDIS) index=0; | |
| 8174 | |||
| 8175 | ✗ | music_stop(); | |
| 8176 | |||
| 8177 | // Allegro's DIGMID driver (the one normally used on on Linux) gets | ||
| 8178 | // stuck notes when a song stops. This fixes it. | ||
| 8179 | ✗ | if(strcmp(midi_driver->name, "DIGMID")==0) | |
| 8180 | ✗ | zc_set_volume(0, 0); | |
| 8181 | |||
| 8182 | ✗ | zc_set_volume(-1, mixvol(tunes[index].volume,midi_volume>>1)); | |
| 8183 | ✗ | zc_play_midi((MIDI*)tunes[index].data,loop); | |
| 8184 | |||
| 8185 | ✗ | if(tunes[index].start>0) | |
| 8186 | ✗ | zc_midi_seek(tunes[index].start); | |
| 8187 | |||
| 8188 | ✗ | midi_loop_start = tunes[index].loop_start; | |
| 8189 | ✗ | midi_loop_end = tunes[index].loop_end; | |
| 8190 | |||
| 8191 | ✗ | currmidi=index; | |
| 8192 | ✗ | master_volume(digi_volume,midi_volume); | |
| 8193 | 63871 | } | |
| 8194 | |||
| 8195 | 63871 | void jukebox(int32_t index) | |
| 8196 | { | ||
| 8197 |
1/2✓ Branch 0 taken 63871 times.
✗ Branch 1 not taken.
|
63871 | if(index<0) index=MAXMIDIS-1; |
| 8198 | |||
| 8199 |
1/2✓ Branch 0 taken 63871 times.
✗ Branch 1 not taken.
|
63871 | if(index>=MAXMIDIS) index=0; |
| 8200 | |||
| 8201 | // do nothing if it's already playing | ||
| 8202 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 63871 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
63871 | if(index==currmidi && midi_pos>=0) |
| 8203 | { | ||
| 8204 | ✗ | return; | |
| 8205 | } | ||
| 8206 | |||
| 8207 | 63871 | jukebox(index,tunes[index].loop); | |
| 8208 | 63871 | } | |
| 8209 | |||
| 8210 | 16 | void play_DmapMusic() | |
| 8211 | { | ||
| 8212 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (is_headless()) |
| 8213 | 16 | return; | |
| 8214 | |||
| 8215 | static char tfile[2048]; | ||
| 8216 | static int32_t ttrack=0; | ||
| 8217 | ✗ | bool domidi=false; | |
| 8218 | |||
| 8219 | ✗ | if(DMaps[currdmap].tmusic[0]!=0) | |
| 8220 | { | ||
| 8221 | ✗ | if(zcmusic==NULL || | |
| 8222 | ✗ | strcmp(zcmusic->filename,DMaps[currdmap].tmusic)!=0 || | |
| 8223 | ✗ | (zcmusic->type==ZCMF_GME && zcmusic->track != DMaps[currdmap].tmusictrack)) | |
| 8224 | { | ||
| 8225 | ✗ | if(zcmusic != NULL) | |
| 8226 | { | ||
| 8227 | ✗ | zcmusic_stop(zcmusic); | |
| 8228 | ✗ | zcmusic_unload_file(zcmusic); | |
| 8229 | ✗ | zcmusic = NULL; | |
| 8230 | ✗ | } | |
| 8231 | |||
| 8232 | ✗ | zcmusic = zcmusic_load_for_quest(DMaps[currdmap].tmusic, qstpath); | |
| 8233 | |||
| 8234 | ✗ | if(zcmusic!=NULL) | |
| 8235 | { | ||
| 8236 | ✗ | zc_stop_midi(); | |
| 8237 | ✗ | strcpy(tfile,DMaps[currdmap].tmusic); | |
| 8238 | ✗ | zcmusic_play(zcmusic, emusic_volume); | |
| 8239 | ✗ | int32_t temptracks=0; | |
| 8240 | ✗ | temptracks=zcmusic_get_tracks(zcmusic); | |
| 8241 | ✗ | temptracks=(temptracks<2)?1:temptracks; | |
| 8242 | ✗ | ttrack = vbound(DMaps[currdmap].tmusictrack,0,temptracks-1); | |
| 8243 | ✗ | zcmusic_change_track(zcmusic,ttrack); | |
| 8244 | ✗ | } | |
| 8245 | else | ||
| 8246 | { | ||
| 8247 | ✗ | tfile[0] = 0; | |
| 8248 | ✗ | domidi=true; | |
| 8249 | } | ||
| 8250 | ✗ | } | |
| 8251 | ✗ | } | |
| 8252 | else | ||
| 8253 | { | ||
| 8254 | ✗ | domidi=true; | |
| 8255 | } | ||
| 8256 | |||
| 8257 | ✗ | if(domidi) | |
| 8258 | { | ||
| 8259 | ✗ | int32_t m=DMaps[currdmap].midi; | |
| 8260 | |||
| 8261 | ✗ | switch(m) | |
| 8262 | { | ||
| 8263 | case 1: | ||
| 8264 | ✗ | jukebox(ZC_MIDI_OVERWORLD); | |
| 8265 | ✗ | break; | |
| 8266 | |||
| 8267 | case 2: | ||
| 8268 | ✗ | jukebox(ZC_MIDI_DUNGEON); | |
| 8269 | ✗ | break; | |
| 8270 | |||
| 8271 | case 3: | ||
| 8272 | ✗ | jukebox(ZC_MIDI_LEVEL9); | |
| 8273 | ✗ | break; | |
| 8274 | |||
| 8275 | default: | ||
| 8276 | ✗ | if(m>=4 && m<4+MAXCUSTOMMIDIS) | |
| 8277 | ✗ | jukebox(m+MIDIOFFSET_DMAP); | |
| 8278 | else | ||
| 8279 | ✗ | music_stop(); | |
| 8280 | ✗ | } | |
| 8281 | ✗ | } | |
| 8282 | 16 | } | |
| 8283 | |||
| 8284 | 15753 | void playLevelMusic() | |
| 8285 | { | ||
| 8286 |
1/2✓ Branch 0 taken 15753 times.
✗ Branch 1 not taken.
|
15753 | if (is_headless()) |
| 8287 | 15753 | return; | |
| 8288 | |||
| 8289 | ✗ | int32_t m=tmpscr->screen_midi; | |
| 8290 | |||
| 8291 | ✗ | switch(m) | |
| 8292 | { | ||
| 8293 | case -2: | ||
| 8294 | ✗ | music_stop(); | |
| 8295 | ✗ | break; | |
| 8296 | |||
| 8297 | case -1: | ||
| 8298 | ✗ | play_DmapMusic(); | |
| 8299 | ✗ | break; | |
| 8300 | |||
| 8301 | case 1: | ||
| 8302 | ✗ | jukebox(ZC_MIDI_OVERWORLD); | |
| 8303 | ✗ | break; | |
| 8304 | |||
| 8305 | case 2: | ||
| 8306 | ✗ | jukebox(ZC_MIDI_DUNGEON); | |
| 8307 | ✗ | break; | |
| 8308 | |||
| 8309 | case 3: | ||
| 8310 | ✗ | jukebox(ZC_MIDI_LEVEL9); | |
| 8311 | ✗ | break; | |
| 8312 | |||
| 8313 | default: | ||
| 8314 | ✗ | if(m>=4 && m<4+MAXCUSTOMMIDIS) | |
| 8315 | ✗ | jukebox(m+MIDIOFFSET_MAPSCR); | |
| 8316 | else | ||
| 8317 | ✗ | music_stop(); | |
| 8318 | ✗ | } | |
| 8319 | 15753 | } | |
| 8320 | |||
| 8321 | 46 | void master_volume(int32_t dv,int32_t mv) | |
| 8322 | { | ||
| 8323 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
✓ Branch 2 taken 46 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 46 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 46 times.
✗ Branch 7 not taken.
|
46 | if(dv>=0) digi_volume=zc_max(zc_min(dv,255),0); |
| 8324 | |||
| 8325 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
✓ Branch 2 taken 46 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 46 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 46 times.
✗ Branch 7 not taken.
|
46 | if(mv>=0) midi_volume=zc_max(zc_min(mv,255),0); |
| 8326 | |||
| 8327 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
✓ Branch 2 taken 46 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 46 times.
|
46 | int32_t i = zc_min(zc_max(currmidi,0),MAXMIDIS-1); |
| 8328 | 46 | zc_set_volume(digi_volume,mixvol(tunes[i].volume,midi_volume)); | |
| 8329 | 46 | } | |
| 8330 | |||
| 8331 | /*****************/ | ||
| 8332 | /***** SFX *****/ | ||
| 8333 | /*****************/ | ||
| 8334 | |||
| 8335 | // array of voices, one for each sfx sample in the data file | ||
| 8336 | // 0+ = voice # | ||
| 8337 | // -1 = voice not allocated | ||
| 8338 | 46 | void Z_init_sound() | |
| 8339 | { | ||
| 8340 |
2/2✓ Branch 0 taken 11776 times.
✓ Branch 1 taken 46 times.
|
11822 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8341 | 11776 | sfx_voice[i]=-1; | |
| 8342 | |||
| 8343 |
2/2✓ Branch 0 taken 322 times.
✓ Branch 1 taken 46 times.
|
368 | for(int32_t i=0; i<ZC_MIDI_COUNT; i++) |
| 8344 | 322 | tunes[i].data = (MIDI*)mididata[i].dat; | |
| 8345 | |||
| 8346 |
2/2✓ Branch 0 taken 11592 times.
✓ Branch 1 taken 46 times.
|
11638 | for(int32_t j=0; j<MAXCUSTOMMIDIS; j++) |
| 8347 | 11592 | tunes[ZC_MIDI_COUNT+j].data=NULL; | |
| 8348 | |||
| 8349 | 46 | master_volume(digi_volume,midi_volume); | |
| 8350 | 46 | } | |
| 8351 | |||
| 8352 | // returns number of voices currently allocated | ||
| 8353 | ✗ | int32_t sfx_count() | |
| 8354 | { | ||
| 8355 | ✗ | int32_t c=0; | |
| 8356 | |||
| 8357 | ✗ | for(int32_t i=0; i<WAV_COUNT; i++) | |
| 8358 | ✗ | if(sfx_voice[i]!=-1) | |
| 8359 | ✗ | ++c; | |
| 8360 | |||
| 8361 | ✗ | return c; | |
| 8362 | } | ||
| 8363 | |||
| 8364 | // clean up finished samples | ||
| 8365 | 9216210 | void sfx_cleanup() | |
| 8366 | { | ||
| 8367 |
2/2✓ Branch 0 taken 2359349760 times.
✓ Branch 1 taken 9216210 times.
|
2368565970 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8368 |
3/4✓ Branch 0 taken 619254 times.
✓ Branch 1 taken 2358730506 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 619254 times.
|
2359969014 | if(sfx_voice[i]!=-1 && voice_get_position(sfx_voice[i])<0) |
| 8369 | { | ||
| 8370 | 619254 | deallocate_voice(sfx_voice[i]); | |
| 8371 | 619254 | sfx_voice[i]=-1; | |
| 8372 | 619254 | } | |
| 8373 | 9216210 | } | |
| 8374 | |||
| 8375 | // allocates a voice for the sample "wav_index" (index into zelda.dat) | ||
| 8376 | // if a voice is already allocated (and/or playing), then it just returns true | ||
| 8377 | // Returns true: voice is allocated | ||
| 8378 | // false: unsuccessful | ||
| 8379 | 963608 | bool sfx_init(int32_t index) | |
| 8380 | { | ||
| 8381 | // check index | ||
| 8382 |
3/4✓ Branch 0 taken 721282 times.
✓ Branch 1 taken 242326 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 721282 times.
|
963608 | if(index<=0 || index>=WAV_COUNT) |
| 8383 | 242326 | return false; | |
| 8384 | |||
| 8385 |
2/2✓ Branch 0 taken 102011 times.
✓ Branch 1 taken 619271 times.
|
721282 | if(sfx_voice[index]==-1) |
| 8386 | { | ||
| 8387 |
2/2✓ Branch 0 taken 209876 times.
✓ Branch 1 taken 409395 times.
|
619271 | if(sfxdat) |
| 8388 | { | ||
| 8389 |
1/2✓ Branch 0 taken 209876 times.
✗ Branch 1 not taken.
|
209876 | if(index<Z35) |
| 8390 | { | ||
| 8391 | 209876 | sfx_voice[index]=allocate_voice((SAMPLE*)sfxdata[index].dat); | |
| 8392 | 209876 | } | |
| 8393 | else | ||
| 8394 | { | ||
| 8395 | ✗ | sfx_voice[index]=allocate_voice((SAMPLE*)sfxdata[Z35].dat); | |
| 8396 | } | ||
| 8397 | 209876 | } | |
| 8398 | else | ||
| 8399 | { | ||
| 8400 | 409395 | sfx_voice[index]=allocate_voice(&customsfxdata[index]); | |
| 8401 | } | ||
| 8402 | |||
| 8403 | 619271 | voice_set_volume(sfx_voice[index], sfx_volume); | |
| 8404 | 619271 | } | |
| 8405 | |||
| 8406 | 721282 | return sfx_voice[index] != -1; | |
| 8407 | 963608 | } | |
| 8408 | |||
| 8409 | // plays an sfx sample | ||
| 8410 | 963608 | void sfx(int32_t index,int32_t pan,bool loop, bool restart) | |
| 8411 | { | ||
| 8412 |
2/2✓ Branch 0 taken 721282 times.
✓ Branch 1 taken 242326 times.
|
963608 | if(!sfx_init(index)) |
| 8413 | 242326 | return; | |
| 8414 | |||
| 8415 |
1/2✓ Branch 0 taken 721282 times.
✗ Branch 1 not taken.
|
721282 | if (!is_headless()) |
| 8416 | { | ||
| 8417 | ✗ | voice_set_playmode(sfx_voice[index],loop?PLAYMODE_LOOP:PLAYMODE_PLAY); | |
| 8418 | ✗ | voice_set_pan(sfx_voice[index],pan); | |
| 8419 | |||
| 8420 | ✗ | int32_t pos = voice_get_position(sfx_voice[index]); | |
| 8421 | |||
| 8422 | ✗ | if(restart) voice_set_position(sfx_voice[index],0); | |
| 8423 | |||
| 8424 | ✗ | if(pos<=0) | |
| 8425 | ✗ | voice_start(sfx_voice[index]); | |
| 8426 | ✗ | } | |
| 8427 | |||
| 8428 |
3/4✓ Branch 0 taken 398006 times.
✓ Branch 1 taken 323276 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 398006 times.
|
721282 | if (restart && replay_is_debug()) |
| 8429 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 398006 times.
|
398006 | replay_step_comment(fmt::format("sfx {}", sfx_string[index])); |
| 8430 | 963608 | } | |
| 8431 | |||
| 8432 | // true if sfx is allocated | ||
| 8433 | 67537 | bool sfx_allocated(int32_t index) | |
| 8434 | { | ||
| 8435 |
3/4✓ Branch 0 taken 9408 times.
✓ Branch 1 taken 58129 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9408 times.
|
67537 | return (index>0 && index<WAV_COUNT && sfx_voice[index]!=-1); |
| 8436 | } | ||
| 8437 | |||
| 8438 | // start it (in loop mode) if it's not already playing, | ||
| 8439 | // otherwise adjust it to play in loop mode -DD | ||
| 8440 | 178463 | void cont_sfx(int32_t index) | |
| 8441 | { | ||
| 8442 |
1/2✓ Branch 0 taken 178463 times.
✗ Branch 1 not taken.
|
178463 | if (is_headless()) |
| 8443 | 178463 | return; | |
| 8444 | |||
| 8445 | ✗ | if(!sfx_init(index)) | |
| 8446 | { | ||
| 8447 | ✗ | return; | |
| 8448 | } | ||
| 8449 | |||
| 8450 | ✗ | if(voice_get_position(sfx_voice[index])<=0) | |
| 8451 | { | ||
| 8452 | ✗ | voice_set_position(sfx_voice[index],0); | |
| 8453 | ✗ | voice_set_playmode(sfx_voice[index],PLAYMODE_LOOP); | |
| 8454 | ✗ | voice_start(sfx_voice[index]); | |
| 8455 | ✗ | } | |
| 8456 | else | ||
| 8457 | { | ||
| 8458 | ✗ | adjust_sfx(index, 128, true); | |
| 8459 | } | ||
| 8460 | 178463 | } | |
| 8461 | |||
| 8462 | // adjust parameters while playing | ||
| 8463 | 4075 | void adjust_sfx(int32_t index,int32_t pan,bool loop) | |
| 8464 | { | ||
| 8465 |
4/6✓ Branch 0 taken 2315 times.
✓ Branch 1 taken 1760 times.
✓ Branch 2 taken 2315 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2315 times.
|
4075 | if(index<=0 || index>=WAV_COUNT || sfx_voice[index]==-1) |
| 8466 | 4075 | return; | |
| 8467 | |||
| 8468 | ✗ | voice_set_playmode(sfx_voice[index],loop?PLAYMODE_LOOP:PLAYMODE_PLAY); | |
| 8469 | ✗ | voice_set_pan(sfx_voice[index],pan); | |
| 8470 | 4075 | } | |
| 8471 | |||
| 8472 | // pauses a voice | ||
| 8473 | 1725 | void pause_sfx(int32_t index) | |
| 8474 | { | ||
| 8475 |
3/6✓ Branch 0 taken 1725 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1725 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1725 times.
|
1725 | if(index>0 && index<WAV_COUNT && sfx_voice[index]!=-1) |
| 8476 | ✗ | voice_stop(sfx_voice[index]); | |
| 8477 | 1725 | } | |
| 8478 | |||
| 8479 | // resumes a voice | ||
| 8480 | 747 | void resume_sfx(int32_t index) | |
| 8481 | { | ||
| 8482 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 747 times.
|
747 | if (is_headless()) |
| 8483 | 747 | return; | |
| 8484 | |||
| 8485 | ✗ | if(index>0 && index<WAV_COUNT && sfx_voice[index]!=-1) | |
| 8486 | ✗ | voice_start(sfx_voice[index]); | |
| 8487 | 747 | } | |
| 8488 | |||
| 8489 | // pauses all active voices | ||
| 8490 | 451 | void pause_all_sfx() | |
| 8491 | { | ||
| 8492 |
2/2✓ Branch 0 taken 115456 times.
✓ Branch 1 taken 451 times.
|
115907 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8493 |
2/2✓ Branch 0 taken 115455 times.
✓ Branch 1 taken 1 times.
|
115457 | if(sfx_voice[i]!=-1) |
| 8494 | 1 | voice_stop(sfx_voice[i]); | |
| 8495 | 451 | } | |
| 8496 | |||
| 8497 | // resumes all paused voices | ||
| 8498 | 438 | void resume_all_sfx() | |
| 8499 | { | ||
| 8500 |
2/2✓ Branch 0 taken 112128 times.
✓ Branch 1 taken 438 times.
|
112566 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8501 |
1/2✓ Branch 0 taken 112128 times.
✗ Branch 1 not taken.
|
112128 | if(sfx_voice[i]!=-1) |
| 8502 | ✗ | voice_start(sfx_voice[i]); | |
| 8503 | 438 | } | |
| 8504 | |||
| 8505 | // stops an sfx and deallocates the voice | ||
| 8506 | 7318087 | void stop_sfx(int32_t index) | |
| 8507 | { | ||
| 8508 |
3/4✓ Branch 0 taken 6167433 times.
✓ Branch 1 taken 1150654 times.
✓ Branch 2 taken 6167433 times.
✗ Branch 3 not taken.
|
7318087 | if(index<=0 || index>=WAV_COUNT) |
| 8509 | 1150654 | return; | |
| 8510 | |||
| 8511 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 6167422 times.
|
6167433 | if(sfx_voice[index]!=-1) |
| 8512 | { | ||
| 8513 | 11 | deallocate_voice(sfx_voice[index]); | |
| 8514 | 11 | sfx_voice[index]=-1; | |
| 8515 | 11 | } | |
| 8516 | 7318087 | } | |
| 8517 | |||
| 8518 | // Stops SFX played by Hero's item of the given family | ||
| 8519 | 128638 | void stop_item_sfx(int32_t family) | |
| 8520 | { | ||
| 8521 | 128638 | int32_t id=current_item_id(family); | |
| 8522 | |||
| 8523 |
2/2✓ Branch 0 taken 128083 times.
✓ Branch 1 taken 555 times.
|
128638 | if(id<0) |
| 8524 | 128083 | return; | |
| 8525 | |||
| 8526 | 555 | stop_sfx(itemsbuf[id].usesound); | |
| 8527 | 128638 | } | |
| 8528 | |||
| 8529 | 3220 | void kill_sfx() | |
| 8530 | { | ||
| 8531 |
2/2✓ Branch 0 taken 824320 times.
✓ Branch 1 taken 3220 times.
|
827540 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8532 |
2/2✓ Branch 0 taken 824314 times.
✓ Branch 1 taken 6 times.
|
824326 | if(sfx_voice[i]!=-1) |
| 8533 | { | ||
| 8534 | 6 | deallocate_voice(sfx_voice[i]); | |
| 8535 | 6 | sfx_voice[i]=-1; | |
| 8536 | 6 | } | |
| 8537 | 3220 | } | |
| 8538 | |||
| 8539 | 659813 | int32_t pan(int32_t x) | |
| 8540 | { | ||
| 8541 |
1/4✓ Branch 0 taken 659813 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
659813 | switch(pan_style) |
| 8542 | { | ||
| 8543 | case 0: | ||
| 8544 | ✗ | return 128; | |
| 8545 | |||
| 8546 | case 1: | ||
| 8547 | 659813 | return vbound((x>>1)+68,0,255); | |
| 8548 | |||
| 8549 | case 2: | ||
| 8550 | ✗ | return vbound(((x*3)>>2)+36,0,255); | |
| 8551 | } | ||
| 8552 | |||
| 8553 | ✗ | return vbound(x,0,255); | |
| 8554 | 659813 | } | |
| 8555 | |||
| 8556 | /*******************************/ | ||
| 8557 | /******* Input Handlers ********/ | ||
| 8558 | /*******************************/ | ||
| 8559 | |||
| 8560 | 25088805 | bool joybtn(int32_t b) | |
| 8561 | { | ||
| 8562 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25088805 times.
|
25088805 | if(b == 0) |
| 8563 | ✗ | return false; | |
| 8564 | |||
| 8565 | 25088805 | return joy[joystick_index].button[b-1].b !=0; | |
| 8566 | 25088805 | } | |
| 8567 | |||
| 8568 | ✗ | const char* joybtn_name(int32_t b) | |
| 8569 | { | ||
| 8570 | ✗ | if(b == 0) | |
| 8571 | ✗ | return ""; | |
| 8572 | |||
| 8573 | ✗ | return joy[joystick_index].button[b-1].name; | |
| 8574 | ✗ | } | |
| 8575 | |||
| 8576 | int32_t next_press_key(); | ||
| 8577 | |||
| 8578 | ✗ | int32_t next_press_btn() | |
| 8579 | { | ||
| 8580 | ✗ | clear_keybuf(); | |
| 8581 | /*bool b[joy[joystick_index].num_buttons+1]; | ||
| 8582 | |||
| 8583 | for(int32_t i=1; i<=joy[joystick_index].num_buttons; i++) | ||
| 8584 | b[i]=joybtn(i);*/ | ||
| 8585 | |||
| 8586 | //first, we need to wait until they're pressing no buttons | ||
| 8587 | ✗ | for(;;) | |
| 8588 | { | ||
| 8589 | ✗ | if(keypressed()) | |
| 8590 | { | ||
| 8591 | ✗ | switch(readkey()>>8) | |
| 8592 | { | ||
| 8593 | case KEY_ESC: | ||
| 8594 | ✗ | return -1; | |
| 8595 | |||
| 8596 | case KEY_SPACE: | ||
| 8597 | ✗ | return 0; | |
| 8598 | } | ||
| 8599 | ✗ | } | |
| 8600 | |||
| 8601 | ✗ | poll_joystick(); | |
| 8602 | ✗ | bool done = true; | |
| 8603 | |||
| 8604 | ✗ | for(int32_t i=1; i<=joy[joystick_index].num_buttons; i++) | |
| 8605 | { | ||
| 8606 | ✗ | if(joybtn(i)) done = false; | |
| 8607 | ✗ | } | |
| 8608 | |||
| 8609 | ✗ | if(done) break; | |
| 8610 | ✗ | rest(1); | |
| 8611 | } | ||
| 8612 | |||
| 8613 | //now, we need to wait for them to press any button | ||
| 8614 | ✗ | for(;;) | |
| 8615 | { | ||
| 8616 | ✗ | if(keypressed()) | |
| 8617 | { | ||
| 8618 | ✗ | switch(readkey()>>8) | |
| 8619 | { | ||
| 8620 | case KEY_ESC: | ||
| 8621 | ✗ | return -1; | |
| 8622 | |||
| 8623 | case KEY_SPACE: | ||
| 8624 | ✗ | return 0; | |
| 8625 | } | ||
| 8626 | ✗ | } | |
| 8627 | |||
| 8628 | ✗ | poll_joystick(); | |
| 8629 | |||
| 8630 | ✗ | for(int32_t i=1; i<=joy[joystick_index].num_buttons; i++) | |
| 8631 | { | ||
| 8632 | ✗ | if(joybtn(i)) return i; | |
| 8633 | ✗ | } | |
| 8634 | ✗ | rest(1); | |
| 8635 | } | ||
| 8636 | ✗ | } | |
| 8637 | |||
| 8638 | 1198535 | static bool rButton(bool &btn, bool &flag, bool rawbtn) | |
| 8639 | { | ||
| 8640 |
2/2✓ Branch 0 taken 1194055 times.
✓ Branch 1 taken 4480 times.
|
1198535 | bool ret = btn && !flag; |
| 8641 | 1198535 | flag = rawbtn; | |
| 8642 | |||
| 8643 | 1198535 | return ret; | |
| 8644 | } | ||
| 8645 | 190895652 | static bool rButton(bool &btn, bool &flag) | |
| 8646 | { | ||
| 8647 |
2/2✓ Branch 0 taken 184052419 times.
✓ Branch 1 taken 6843233 times.
|
190895652 | bool ret = btn && !flag; |
| 8648 | 190895652 | flag = btn; | |
| 8649 | |||
| 8650 | 190895652 | return ret; | |
| 8651 | } | ||
| 8652 | 1846969 | static bool rButtonPeek(bool btn, bool flag) | |
| 8653 | { | ||
| 8654 |
2/2✓ Branch 0 taken 1644296 times.
✓ Branch 1 taken 202673 times.
|
1846969 | if(!btn) |
| 8655 | { | ||
| 8656 | 1644296 | return false; | |
| 8657 | } | ||
| 8658 |
2/2✓ Branch 0 taken 17699 times.
✓ Branch 1 taken 184974 times.
|
202673 | else if(!flag) |
| 8659 | { | ||
| 8660 | 17699 | return true; | |
| 8661 | } | ||
| 8662 | |||
| 8663 | 184974 | return false; | |
| 8664 | 1846969 | } | |
| 8665 | |||
| 8666 | // Updated only by keyboard/gamepad. | ||
| 8667 | // If in replay mode, this is set directly by the replay system. | ||
| 8668 | // This should never be read from directly - use control_state instead. | ||
| 8669 | bool raw_control_state[ZC_CONTROL_STATES]; | ||
| 8670 | |||
| 8671 | // Every call to load_control_state (pretty much every frame) resets this to be equal to raw_control_state. | ||
| 8672 | // This state can drift from raw_control_state if button states are "eaten" or overriden by a script. But that only | ||
| 8673 | // lasts until the next call to load_control_state. | ||
| 8674 | bool control_state[ZC_CONTROL_STATES]; | ||
| 8675 | bool disable_control[ZC_CONTROL_STATES]; | ||
| 8676 | bool drunk_toggle_state[11]; | ||
| 8677 | bool disabledKeys[127]; | ||
| 8678 | bool KeyInput[127]; | ||
| 8679 | bool KeyPress[127]; | ||
| 8680 | |||
| 8681 | bool key_current_frame[127]; | ||
| 8682 | bool key_previous_frame[127]; | ||
| 8683 | |||
| 8684 | static bool key_system[127]; | ||
| 8685 | static bool key_system_previous[127]; | ||
| 8686 | static bool key_system_press[127]; | ||
| 8687 | |||
| 8688 | bool button_press[ZC_CONTROL_STATES]; | ||
| 8689 | bool button_hold[ZC_CONTROL_STATES]; | ||
| 8690 | |||
| 8691 | #define STICK_1_X joy[joystick_index].stick[js_stick_1_x_stick].axis[js_stick_1_x_axis] | ||
| 8692 | #define STICK_1_Y joy[joystick_index].stick[js_stick_1_y_stick].axis[js_stick_1_y_axis] | ||
| 8693 | #define STICK_2_X joy[joystick_index].stick[js_stick_2_x_stick].axis[js_stick_2_x_axis] | ||
| 8694 | #define STICK_2_Y joy[joystick_index].stick[js_stick_2_y_stick].axis[js_stick_2_y_axis] | ||
| 8695 | #define STICK_PRECISION 56 //define your own sensitivity | ||
| 8696 | |||
| 8697 | 7799051 | void load_control_state() | |
| 8698 | { | ||
| 8699 | 7799051 | load_control_called_this_frame = true; | |
| 8700 | |||
| 8701 |
2/2✓ Branch 0 taken 4831538 times.
✓ Branch 1 taken 2967513 times.
|
7799051 | if (replay_version_check(8, 11)) |
| 8702 | { | ||
| 8703 |
2/2✓ Branch 0 taken 53415234 times.
✓ Branch 1 taken 2967513 times.
|
56382747 | for (int i = 0; i < ZC_CONTROL_STATES; i++) |
| 8704 | 53415234 | down_control_states[i] = raw_control_state[i]; | |
| 8705 | 2967513 | } | |
| 8706 | |||
| 8707 |
1/2✓ Branch 0 taken 7799051 times.
✗ Branch 1 not taken.
|
7799051 | if (!replay_is_replaying()) |
| 8708 | { | ||
| 8709 | ✗ | raw_control_state[0]=zc_getrawkey(DUkey, true)||(analog_movement ? STICK_1_Y.d1 || STICK_1_Y.pos - js_stick_1_y_offset < -STICK_PRECISION : joybtn(DUbtn)); | |
| 8710 | ✗ | raw_control_state[1]=zc_getrawkey(DDkey, true)||(analog_movement ? STICK_1_Y.d2 || STICK_1_Y.pos - js_stick_1_y_offset > STICK_PRECISION : joybtn(DDbtn)); | |
| 8711 | ✗ | raw_control_state[2]=zc_getrawkey(DLkey, true)||(analog_movement ? STICK_1_X.d1 || STICK_1_X.pos - js_stick_1_x_offset < -STICK_PRECISION : joybtn(DLbtn)); | |
| 8712 | ✗ | raw_control_state[3]=zc_getrawkey(DRkey, true)||(analog_movement ? STICK_1_X.d2 || STICK_1_X.pos - js_stick_1_x_offset > STICK_PRECISION : joybtn(DRbtn)); | |
| 8713 | ✗ | raw_control_state[4]=zc_getrawkey(Akey, true)||joybtn(Abtn); | |
| 8714 | ✗ | raw_control_state[5]=zc_getrawkey(Bkey, true)||joybtn(Bbtn); | |
| 8715 | ✗ | raw_control_state[6]=zc_getrawkey(Skey, true)||joybtn(Sbtn); | |
| 8716 | ✗ | raw_control_state[7]=zc_getrawkey(Lkey, true)||joybtn(Lbtn); | |
| 8717 | ✗ | raw_control_state[8]=zc_getrawkey(Rkey, true)||joybtn(Rbtn); | |
| 8718 | ✗ | raw_control_state[9]=zc_getrawkey(Pkey, true)||joybtn(Pbtn); | |
| 8719 | ✗ | raw_control_state[10]=zc_getrawkey(Exkey1, true)||joybtn(Exbtn1); | |
| 8720 | ✗ | raw_control_state[11]=zc_getrawkey(Exkey2, true)||joybtn(Exbtn2); | |
| 8721 | ✗ | raw_control_state[12]=zc_getrawkey(Exkey3, true)||joybtn(Exbtn3); | |
| 8722 | ✗ | raw_control_state[13]=zc_getrawkey(Exkey4, true)||joybtn(Exbtn4); | |
| 8723 | |||
| 8724 | ✗ | if(num_joysticks != 0) | |
| 8725 | { | ||
| 8726 | ✗ | raw_control_state[14] = STICK_2_Y.pos - js_stick_2_y_offset < -STICK_PRECISION; | |
| 8727 | ✗ | raw_control_state[15] = STICK_2_Y.pos - js_stick_2_y_offset > STICK_PRECISION; | |
| 8728 | ✗ | raw_control_state[16] = STICK_2_X.pos - js_stick_2_x_offset < -STICK_PRECISION; | |
| 8729 | ✗ | raw_control_state[17] = STICK_2_X.pos - js_stick_2_x_offset > STICK_PRECISION; | |
| 8730 | // zprint2("Detected %d joysticks... %d%d%d%d\n", num_joysticks, raw_control_state[14]?1:0, raw_control_state[15]?1:0, raw_control_state[16]?1:0, raw_control_state[17]?1:0); | ||
| 8731 | ✗ | } | |
| 8732 | else | ||
| 8733 | { | ||
| 8734 | ✗ | raw_control_state[14] = false; | |
| 8735 | ✗ | raw_control_state[15] = false; | |
| 8736 | ✗ | raw_control_state[16] = false; | |
| 8737 | ✗ | raw_control_state[17] = false; | |
| 8738 | // zprint2("Detected 0 joysticks... clearing inputaxis values.\n"); | ||
| 8739 | } | ||
| 8740 | ✗ | bool did_bad_cutscene_btn = false; | |
| 8741 | ✗ | for(int q = 0; q < 18; ++q) | |
| 8742 | ✗ | if(raw_control_state[q] && !active_cutscene.can_button(q)) | |
| 8743 | { | ||
| 8744 | ✗ | raw_control_state[q] = false; | |
| 8745 | ✗ | did_bad_cutscene_btn = true; | |
| 8746 | ✗ | } | |
| 8747 | ✗ | if(did_bad_cutscene_btn) | |
| 8748 | ✗ | active_cutscene.error(); | |
| 8749 | ✗ | } | |
| 8750 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 7799048 times.
|
7799051 | if (replay_is_active()) |
| 8751 | { | ||
| 8752 |
2/2✓ Branch 0 taken 1015215 times.
✓ Branch 1 taken 6783833 times.
|
7799048 | if (replay_get_version() < 3) |
| 8753 | 1015215 | replay_poll(); | |
| 8754 |
3/4✓ Branch 0 taken 6783833 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5022458 times.
✓ Branch 3 taken 1761375 times.
|
6783833 | else if (replay_is_replaying() && replay_get_version() < 6) |
| 8755 | 1761375 | replay_peek_input(); | |
| 8756 |
3/4✓ Branch 0 taken 5022458 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2054945 times.
✓ Branch 3 taken 2967513 times.
|
5022458 | else if (replay_is_replaying() && replay_version_check(8, 11)) |
| 8757 | 2967513 | replay_peek_input(); | |
| 8758 |
2/2✓ Branch 0 taken 6694758 times.
✓ Branch 1 taken 1104290 times.
|
7799048 | if (replay_get_version() == 8) |
| 8759 | 1104290 | update_keys(); | |
| 8760 | 7799048 | } | |
| 8761 | |||
| 8762 | // Some test replay files were made before a serious input bug was fixed, so instead | ||
| 8763 | // of re-doing them or tossing them out, just check for that zplay version. | ||
| 8764 |
3/4✓ Branch 0 taken 7799045 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 121900 times.
✓ Branch 3 taken 7677145 times.
|
7799051 | bool botched_input = replay_is_active() && replay_get_version() != 1 && replay_get_version() < 8; |
| 8765 |
2/2✓ Branch 0 taken 7799045 times.
✓ Branch 1 taken 140382810 times.
|
148181855 | for (int i = 0; i < ZC_CONTROL_STATES; i++) |
| 8766 | { | ||
| 8767 | 140382810 | control_state[i] = raw_control_state[i]; | |
| 8768 |
4/4✓ Branch 0 taken 49487310 times.
✓ Branch 1 taken 90895500 times.
✓ Branch 2 taken 2410168 times.
✓ Branch 3 taken 47077142 times.
|
140382810 | if (botched_input && !control_state[i]) |
| 8769 | 47077142 | down_control_states[i] = false; | |
| 8770 | 140382810 | } | |
| 8771 | |||
| 8772 | 7799045 | button_press[0]=rButton(control_state[0],button_hold[0]); | |
| 8773 | 7799045 | button_press[1]=rButton(control_state[1],button_hold[1]); | |
| 8774 | 7799045 | button_press[2]=rButton(control_state[2],button_hold[2]); | |
| 8775 | 7799045 | button_press[3]=rButton(control_state[3],button_hold[3]); | |
| 8776 | 7799045 | button_press[4]=rButton(control_state[4],button_hold[4]); | |
| 8777 | 7799045 | button_press[5]=rButton(control_state[5],button_hold[5]); | |
| 8778 | 7799045 | button_press[6]=rButton(control_state[6],button_hold[6]); | |
| 8779 | 7799045 | button_press[7]=rButton(control_state[7],button_hold[7]); | |
| 8780 | 7799045 | button_press[8]=rButton(control_state[8],button_hold[8]); | |
| 8781 | 7799045 | button_press[9]=rButton(control_state[9],button_hold[9]); | |
| 8782 | 7799045 | button_press[10]=rButton(control_state[10],button_hold[10]); | |
| 8783 | 7799045 | button_press[11]=rButton(control_state[11],button_hold[11]); | |
| 8784 | 7799045 | button_press[12]=rButton(control_state[12],button_hold[12]); | |
| 8785 | 7799045 | button_press[13]=rButton(control_state[13],button_hold[13]); | |
| 8786 | 7799045 | button_press[14]=rButton(control_state[14],button_hold[14]); | |
| 8787 | 7799045 | button_press[15]=rButton(control_state[15],button_hold[15]); | |
| 8788 | 7799045 | button_press[16]=rButton(control_state[16],button_hold[16]); | |
| 8789 | 7799045 | button_press[17]=rButton(control_state[17],button_hold[17]); | |
| 8790 | 7799045 | } | |
| 8791 | |||
| 8792 | // Returns true if any game key is pressed. This is needed because keypressed() | ||
| 8793 | // doesn't detect modifier keys and control_state[] can be modified by scripts. | ||
| 8794 | 40242214 | bool zc_key_pressed() | |
| 8795 | //may also need to use zc_getrawkey | ||
| 8796 | { | ||
| 8797 |
7/10✓ Branch 0 taken 32591229 times.
✓ Branch 1 taken 7650985 times.
✓ Branch 2 taken 7650985 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7650985 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6394916 times.
✓ Branch 7 taken 6394916 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2461268 times.
|
42703482 | if((zc_getrawkey(DUkey, true)||(analog_movement ? STICK_1_Y.d1 || STICK_1_Y.pos - js_stick_1_y_offset< -STICK_PRECISION : joybtn(DUbtn))) || |
| 8798 |
4/6✓ Branch 0 taken 6394916 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6394916 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4843285 times.
✓ Branch 5 taken 4843285 times.
|
6394916 | (zc_getrawkey(DDkey, true)||(analog_movement ? STICK_1_Y.d2 || STICK_1_Y.pos - js_stick_1_y_offset > STICK_PRECISION : joybtn(DDbtn))) || |
| 8799 |
4/6✓ Branch 0 taken 4843285 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4843285 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3142666 times.
✓ Branch 5 taken 3142666 times.
|
4843285 | (zc_getrawkey(DLkey, true)||(analog_movement ? STICK_1_X.d1 || STICK_1_X.pos - js_stick_1_x_offset < -STICK_PRECISION : joybtn(DLbtn))) || |
| 8800 |
4/6✓ Branch 0 taken 3142666 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3142666 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2731732 times.
✓ Branch 5 taken 2731732 times.
|
3142666 | (zc_getrawkey(DRkey, true)||(analog_movement ? STICK_1_X.d2 || STICK_1_X.pos - js_stick_1_x_offset > STICK_PRECISION : joybtn(DRbtn))) || |
| 8801 |
1/2✓ Branch 0 taken 2731732 times.
✗ Branch 1 not taken.
|
2731732 | (zc_getrawkey(Akey, true)||joybtn(Abtn)) || |
| 8802 |
3/4✓ Branch 0 taken 2612325 times.
✓ Branch 1 taken 119407 times.
✓ Branch 2 taken 2612325 times.
✗ Branch 3 not taken.
|
2731732 | (zc_getrawkey(Bkey, true)||joybtn(Bbtn)) || |
| 8803 |
3/4✓ Branch 0 taken 2493431 times.
✓ Branch 1 taken 118894 times.
✓ Branch 2 taken 2493431 times.
✗ Branch 3 not taken.
|
2612325 | (zc_getrawkey(Skey, true)||joybtn(Sbtn)) || |
| 8804 |
3/4✓ Branch 0 taken 2478286 times.
✓ Branch 1 taken 15145 times.
✓ Branch 2 taken 2478286 times.
✗ Branch 3 not taken.
|
2493431 | (zc_getrawkey(Lkey, true)||joybtn(Lbtn)) || |
| 8805 |
3/4✓ Branch 0 taken 2464787 times.
✓ Branch 1 taken 13499 times.
✓ Branch 2 taken 2464787 times.
✗ Branch 3 not taken.
|
2478286 | (zc_getrawkey(Rkey, true)||joybtn(Rbtn)) || |
| 8806 |
3/4✓ Branch 0 taken 2462293 times.
✓ Branch 1 taken 2494 times.
✓ Branch 2 taken 2462293 times.
✗ Branch 3 not taken.
|
2464787 | (zc_getrawkey(Pkey, true)||joybtn(Pbtn)) || |
| 8807 |
3/4✓ Branch 0 taken 2462103 times.
✓ Branch 1 taken 190 times.
✓ Branch 2 taken 2462103 times.
✗ Branch 3 not taken.
|
2462293 | (zc_getrawkey(Exkey1, true)||joybtn(Exbtn1)) || |
| 8808 |
3/4✓ Branch 0 taken 2461293 times.
✓ Branch 1 taken 810 times.
✓ Branch 2 taken 2461293 times.
✗ Branch 3 not taken.
|
2462103 | (zc_getrawkey(Exkey2, true)||joybtn(Exbtn2)) || |
| 8809 |
3/4✓ Branch 0 taken 2461287 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2461287 times.
✗ Branch 3 not taken.
|
2461293 | (zc_getrawkey(Exkey3, true)||joybtn(Exbtn3)) || |
| 8810 |
2/2✓ Branch 0 taken 2461268 times.
✓ Branch 1 taken 19 times.
|
2461287 | (zc_getrawkey(Exkey4, true)||joybtn(Exbtn4))) // Skipping joystick axes |
| 8811 | 72006144 | return true; | |
| 8812 | |||
| 8813 | 2461268 | return false; | |
| 8814 | 9284954 | } | |
| 8815 | |||
| 8816 | 149218891 | bool getInput(int32_t btn, bool press, bool drunk, bool ignoreDisable, bool eatEntirely, bool peek) | |
| 8817 | { | ||
| 8818 | 149218891 | bool ret = false, drunkstate = false, rawret = false;; | |
| 8819 | 149218891 | bool* flag = &down_control_states[btn]; | |
| 8820 |
2/7✓ Branch 0 taken 139924601 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 9294290 times.
|
149218891 | switch(btn) |
| 8821 | { | ||
| 8822 | case btnF12: | ||
| 8823 | ✗ | ret = zc_getkey(KEY_F12, ignoreDisable); | |
| 8824 | ✗ | rawret = zc_getrawkey(KEY_F12, ignoreDisable); | |
| 8825 | ✗ | eatEntirely = false; | |
| 8826 | ✗ | break; | |
| 8827 | case btnF11: | ||
| 8828 | ✗ | ret = zc_getkey(KEY_F11, ignoreDisable); | |
| 8829 | ✗ | rawret = zc_getrawkey(KEY_F11, ignoreDisable); | |
| 8830 | ✗ | eatEntirely = false; | |
| 8831 | ✗ | break; | |
| 8832 | case btnF5: | ||
| 8833 | ✗ | ret = zc_getkey(KEY_F5, ignoreDisable); | |
| 8834 | ✗ | rawret = zc_getrawkey(KEY_F5, ignoreDisable); | |
| 8835 | ✗ | eatEntirely = false; | |
| 8836 | ✗ | break; | |
| 8837 | case btnQ: | ||
| 8838 | ✗ | ret = zc_getkey(KEY_Q, ignoreDisable); | |
| 8839 | ✗ | rawret = zc_getrawkey(KEY_Q, ignoreDisable); | |
| 8840 | ✗ | eatEntirely = false; | |
| 8841 | ✗ | break; | |
| 8842 | case btnI: | ||
| 8843 | ✗ | ret = zc_getkey(KEY_I, ignoreDisable); | |
| 8844 | ✗ | rawret = zc_getrawkey(KEY_I, ignoreDisable); | |
| 8845 | ✗ | eatEntirely = false; | |
| 8846 | ✗ | break; | |
| 8847 | case btnM: | ||
| 8848 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9294290 times.
|
9294290 | if(FFCore.kb_typing_mode) return false; |
| 8849 | 9294290 | rawret = ret = zc_getrawkey(KEY_ESC, ignoreDisable); | |
| 8850 | 9294290 | eatEntirely = false; | |
| 8851 | 9294290 | break; | |
| 8852 | default: //control_state[] index | ||
| 8853 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 139924601 times.
|
139924601 | if(FFCore.kb_typing_mode) return false; |
| 8854 |
5/6✓ Branch 0 taken 139125144 times.
✓ Branch 1 taken 799457 times.
✓ Branch 2 taken 2190363 times.
✓ Branch 3 taken 136934781 times.
✓ Branch 4 taken 2190363 times.
✗ Branch 5 not taken.
|
139924601 | if(!ignoreDisable && get_qr(qr_FIXDRUNKINPUTS) && disable_control[btn]) drunk = false; |
| 8855 |
2/2✓ Branch 0 taken 7643662 times.
✓ Branch 1 taken 132280939 times.
|
139924601 | else if(btn<11) drunkstate = drunk_toggle_state[btn]; |
| 8856 |
4/4✓ Branch 0 taken 125762927 times.
✓ Branch 1 taken 14161674 times.
✓ Branch 2 taken 2995 times.
✓ Branch 3 taken 14158679 times.
|
154086275 | ret = control_state[btn] && (ignoreDisable || !disable_control[btn]); |
| 8857 | 139924601 | rawret = raw_control_state[btn]; | |
| 8858 | 139924601 | } | |
| 8859 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 149218891 times.
|
149218891 | assert(flag); |
| 8860 |
2/2✓ Branch 0 taken 95660545 times.
✓ Branch 1 taken 53558346 times.
|
149218891 | if(press) |
| 8861 | { | ||
| 8862 |
2/2✓ Branch 0 taken 1846969 times.
✓ Branch 1 taken 51711377 times.
|
53558346 | if(peek) |
| 8863 | 1846969 | ret = rButtonPeek(ret, *flag); | |
| 8864 |
2/2✓ Branch 0 taken 50512842 times.
✓ Branch 1 taken 1198535 times.
|
51711377 | else if(get_qr(qr_BROKEN_INPUT_DOWN_STATE)) ret = rButton(ret, *flag); |
| 8865 | 1198535 | else ret = rButton(ret, *flag, rawret); | |
| 8866 | 53558346 | } | |
| 8867 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 149218891 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
149218891 | if(eatEntirely && ret) control_state[btn] = false; |
| 8868 |
3/4✓ Branch 0 taken 112177277 times.
✓ Branch 1 taken 37041614 times.
✓ Branch 2 taken 112177277 times.
✗ Branch 3 not taken.
|
149218891 | if(drunk && drunkstate) ret = !ret; |
| 8869 | 149218891 | return ret; | |
| 8870 | 149218891 | } | |
| 8871 | |||
| 8872 | 7333007 | byte getIntBtnInput(byte intbtn, bool press, bool drunk, bool ignoreDisable, bool eatEntirely, bool peek) | |
| 8873 | { | ||
| 8874 | 7333007 | byte ret = 0; | |
| 8875 |
2/2✓ Branch 0 taken 5483939 times.
✓ Branch 1 taken 1849068 times.
|
7333007 | if(intbtn & INT_BTN_A) ret |= getInput(btnA, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_A : 0; |
| 8876 |
2/2✓ Branch 0 taken 7332445 times.
✓ Branch 1 taken 562 times.
|
7333007 | if(intbtn & INT_BTN_B) ret |= getInput(btnB, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_B : 0; |
| 8877 |
2/2✓ Branch 0 taken 7332570 times.
✓ Branch 1 taken 437 times.
|
7333007 | if(intbtn & INT_BTN_L) ret |= getInput(btnL, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_L : 0; |
| 8878 |
2/2✓ Branch 0 taken 7332570 times.
✓ Branch 1 taken 437 times.
|
7333007 | if(intbtn & INT_BTN_R) ret |= getInput(btnR, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_R : 0; |
| 8879 |
2/2✓ Branch 0 taken 7332570 times.
✓ Branch 1 taken 437 times.
|
7333007 | if(intbtn & INT_BTN_EX1) ret |= getInput(btnEx1, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_EX1 : 0; |
| 8880 |
2/2✓ Branch 0 taken 7332570 times.
✓ Branch 1 taken 437 times.
|
7333007 | if(intbtn & INT_BTN_EX2) ret |= getInput(btnEx2, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_EX2 : 0; |
| 8881 |
2/2✓ Branch 0 taken 7332570 times.
✓ Branch 1 taken 437 times.
|
7333007 | if(intbtn & INT_BTN_EX3) ret |= getInput(btnEx3, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_EX3 : 0; |
| 8882 |
2/2✓ Branch 0 taken 7332570 times.
✓ Branch 1 taken 437 times.
|
7333007 | if(intbtn & INT_BTN_EX4) ret |= getInput(btnEx4, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_EX4 : 0; |
| 8883 | 7333007 | return ret; //No early return, to make sure all button presses are eaten that should be! -Em | |
| 8884 | } | ||
| 8885 | |||
| 8886 | 1114 | byte checkIntBtnVal(byte intbtn, byte vals) | |
| 8887 | { | ||
| 8888 | 1114 | return intbtn&vals; | |
| 8889 | } | ||
| 8890 | |||
| 8891 | 1767241 | bool Up() | |
| 8892 | { | ||
| 8893 | 1767241 | return getInput(btnUp); | |
| 8894 | } | ||
| 8895 | 146943 | bool Down() | |
| 8896 | { | ||
| 8897 | 146943 | return getInput(btnDown); | |
| 8898 | } | ||
| 8899 | 257358 | bool Left() | |
| 8900 | { | ||
| 8901 | 257358 | return getInput(btnLeft); | |
| 8902 | } | ||
| 8903 | 286551 | bool Right() | |
| 8904 | { | ||
| 8905 | 286551 | return getInput(btnRight); | |
| 8906 | } | ||
| 8907 | 164908 | bool cAbtn() | |
| 8908 | { | ||
| 8909 | 164908 | return getInput(btnA); | |
| 8910 | } | ||
| 8911 | 1411891 | bool cBbtn() | |
| 8912 | { | ||
| 8913 | 1411891 | return getInput(btnB); | |
| 8914 | } | ||
| 8915 | ✗ | bool cSbtn() | |
| 8916 | { | ||
| 8917 | ✗ | return getInput(btnS); | |
| 8918 | } | ||
| 8919 | 68744 | bool cLbtn() | |
| 8920 | { | ||
| 8921 | 68744 | return getInput(btnL); | |
| 8922 | } | ||
| 8923 | 68744 | bool cRbtn() | |
| 8924 | { | ||
| 8925 | 68744 | return getInput(btnR); | |
| 8926 | } | ||
| 8927 | ✗ | bool cPbtn() | |
| 8928 | { | ||
| 8929 | ✗ | return getInput(btnP); | |
| 8930 | } | ||
| 8931 | ✗ | bool cEx1btn() | |
| 8932 | { | ||
| 8933 | ✗ | return getInput(btnEx1); | |
| 8934 | } | ||
| 8935 | ✗ | bool cEx2btn() | |
| 8936 | { | ||
| 8937 | ✗ | return getInput(btnEx2); | |
| 8938 | } | ||
| 8939 | ✗ | bool cEx3btn() | |
| 8940 | { | ||
| 8941 | ✗ | return getInput(btnEx3); | |
| 8942 | } | ||
| 8943 | ✗ | bool cEx4btn() | |
| 8944 | { | ||
| 8945 | ✗ | return getInput(btnEx4); | |
| 8946 | } | ||
| 8947 | ✗ | bool AxisUp() | |
| 8948 | { | ||
| 8949 | ✗ | return getInput(btnAxisUp); | |
| 8950 | } | ||
| 8951 | ✗ | bool AxisDown() | |
| 8952 | { | ||
| 8953 | ✗ | return getInput(btnAxisDown); | |
| 8954 | } | ||
| 8955 | ✗ | bool AxisLeft() | |
| 8956 | { | ||
| 8957 | ✗ | return getInput(btnAxisLeft); | |
| 8958 | } | ||
| 8959 | ✗ | bool AxisRight() | |
| 8960 | { | ||
| 8961 | ✗ | return getInput(btnAxisRight); | |
| 8962 | } | ||
| 8963 | |||
| 8964 | ✗ | bool cMbtn() | |
| 8965 | { | ||
| 8966 | ✗ | return getInput(btnM); | |
| 8967 | } | ||
| 8968 | ✗ | bool cF12() | |
| 8969 | { | ||
| 8970 | ✗ | return getInput(btnF12); | |
| 8971 | } | ||
| 8972 | ✗ | bool cF11() | |
| 8973 | { | ||
| 8974 | ✗ | return getInput(btnF11); | |
| 8975 | } | ||
| 8976 | ✗ | bool cF5() | |
| 8977 | { | ||
| 8978 | ✗ | return getInput(btnF5); | |
| 8979 | } | ||
| 8980 | ✗ | bool cQ() | |
| 8981 | { | ||
| 8982 | ✗ | return getInput(btnQ); | |
| 8983 | } | ||
| 8984 | ✗ | bool cI() | |
| 8985 | { | ||
| 8986 | ✗ | return getInput(btnI); | |
| 8987 | } | ||
| 8988 | |||
| 8989 | 130270 | bool rUp() | |
| 8990 | { | ||
| 8991 | 130270 | return getInput(btnUp, true); | |
| 8992 | } | ||
| 8993 | 130174 | bool rDown() | |
| 8994 | { | ||
| 8995 | 130174 | return getInput(btnDown, true); | |
| 8996 | } | ||
| 8997 | 130122 | bool rLeft() | |
| 8998 | { | ||
| 8999 | 130122 | return getInput(btnLeft, true); | |
| 9000 | } | ||
| 9001 | 129657 | bool rRight() | |
| 9002 | { | ||
| 9003 | 129657 | return getInput(btnRight, true); | |
| 9004 | } | ||
| 9005 | 3145 | bool rAbtn() | |
| 9006 | { | ||
| 9007 | 3145 | return getInput(btnA, true); | |
| 9008 | } | ||
| 9009 | 131548 | bool rBbtn() | |
| 9010 | { | ||
| 9011 | 131548 | return getInput(btnB, true); | |
| 9012 | } | ||
| 9013 | 7395153 | bool rSbtn() | |
| 9014 | { | ||
| 9015 | 7395153 | return getInput(btnS, true); | |
| 9016 | } | ||
| 9017 | 9284954 | bool rMbtn() | |
| 9018 | { | ||
| 9019 | 9284954 | return getInput(btnM, true); | |
| 9020 | } | ||
| 9021 | 129441 | bool rLbtn() | |
| 9022 | { | ||
| 9023 | 129441 | return getInput(btnL, true); | |
| 9024 | } | ||
| 9025 | 129436 | bool rRbtn() | |
| 9026 | { | ||
| 9027 | 129436 | return getInput(btnR, true); | |
| 9028 | } | ||
| 9029 | 7331617 | bool rPbtn() | |
| 9030 | { | ||
| 9031 | 7331617 | return getInput(btnP, true); | |
| 9032 | } | ||
| 9033 | ✗ | bool rEx1btn() | |
| 9034 | { | ||
| 9035 | ✗ | return getInput(btnEx1, true); | |
| 9036 | } | ||
| 9037 | ✗ | bool rEx2btn() | |
| 9038 | { | ||
| 9039 | ✗ | return getInput(btnEx2, true); | |
| 9040 | } | ||
| 9041 | 140087 | bool rEx3btn() | |
| 9042 | { | ||
| 9043 | 140087 | return getInput(btnEx3, true); | |
| 9044 | } | ||
| 9045 | 140087 | bool rEx4btn() | |
| 9046 | { | ||
| 9047 | 140087 | return getInput(btnEx4, true); | |
| 9048 | } | ||
| 9049 | ✗ | bool rAxisUp() | |
| 9050 | { | ||
| 9051 | ✗ | return getInput(btnAxisUp, true); | |
| 9052 | } | ||
| 9053 | ✗ | bool rAxisDown() | |
| 9054 | { | ||
| 9055 | ✗ | return getInput(btnAxisDown, true); | |
| 9056 | } | ||
| 9057 | ✗ | bool rAxisLeft() | |
| 9058 | { | ||
| 9059 | ✗ | return getInput(btnAxisLeft, true); | |
| 9060 | } | ||
| 9061 | ✗ | bool rAxisRight() | |
| 9062 | { | ||
| 9063 | ✗ | return getInput(btnAxisRight, true); | |
| 9064 | } | ||
| 9065 | |||
| 9066 | ✗ | bool rF11() | |
| 9067 | { | ||
| 9068 | ✗ | return getInput(btnF11, true); | |
| 9069 | } | ||
| 9070 | ✗ | bool rQ() | |
| 9071 | { | ||
| 9072 | ✗ | return getInput(btnQ, true); | |
| 9073 | } | ||
| 9074 | ✗ | bool rI() | |
| 9075 | { | ||
| 9076 | ✗ | return getInput(btnI, true); | |
| 9077 | } | ||
| 9078 | |||
| 9079 | 18221767 | bool DrunkUp() | |
| 9080 | { | ||
| 9081 | 18221767 | return getInput(btnUp, false, true); | |
| 9082 | } | ||
| 9083 | 16885102 | bool DrunkDown() | |
| 9084 | { | ||
| 9085 | 16885102 | return getInput(btnDown, false, true); | |
| 9086 | } | ||
| 9087 | 10286365 | bool DrunkLeft() | |
| 9088 | { | ||
| 9089 | 10286365 | return getInput(btnLeft, false, true); | |
| 9090 | } | ||
| 9091 | 8832532 | bool DrunkRight() | |
| 9092 | { | ||
| 9093 | 8832532 | return getInput(btnRight, false, true); | |
| 9094 | } | ||
| 9095 | 8034063 | bool DrunkcAbtn() | |
| 9096 | { | ||
| 9097 | 8034063 | return getInput(btnA, false, true); | |
| 9098 | } | ||
| 9099 | 7848592 | bool DrunkcBbtn() | |
| 9100 | { | ||
| 9101 | 7848592 | return getInput(btnB, false, true); | |
| 9102 | } | ||
| 9103 | 7262487 | bool DrunkcEx1btn() | |
| 9104 | { | ||
| 9105 | 7262487 | return getInput(btnEx1, false, true); | |
| 9106 | } | ||
| 9107 | 7262507 | bool DrunkcEx2btn() | |
| 9108 | { | ||
| 9109 | 7262507 | return getInput(btnEx2, false, true); | |
| 9110 | } | ||
| 9111 | ✗ | bool DrunkcSbtn() | |
| 9112 | { | ||
| 9113 | ✗ | return getInput(btnS, false, true); | |
| 9114 | } | ||
| 9115 | ✗ | bool DrunkcMbtn() | |
| 9116 | { | ||
| 9117 | ✗ | return getInput(btnM, false, true); | |
| 9118 | } | ||
| 9119 | ✗ | bool DrunkcLbtn() | |
| 9120 | { | ||
| 9121 | ✗ | return getInput(btnL, false, true); | |
| 9122 | } | ||
| 9123 | ✗ | bool DrunkcRbtn() | |
| 9124 | { | ||
| 9125 | ✗ | return getInput(btnR, false, true); | |
| 9126 | } | ||
| 9127 | ✗ | bool DrunkcPbtn() | |
| 9128 | { | ||
| 9129 | ✗ | return getInput(btnP, false, true); | |
| 9130 | } | ||
| 9131 | |||
| 9132 | ✗ | bool DrunkrUp() | |
| 9133 | { | ||
| 9134 | ✗ | return getInput(btnUp, true, true); | |
| 9135 | } | ||
| 9136 | ✗ | bool DrunkrDown() | |
| 9137 | { | ||
| 9138 | ✗ | return getInput(btnDown, true, true); | |
| 9139 | } | ||
| 9140 | ✗ | bool DrunkrLeft() | |
| 9141 | { | ||
| 9142 | ✗ | return getInput(btnLeft, true, true); | |
| 9143 | } | ||
| 9144 | ✗ | bool DrunkrRight() | |
| 9145 | { | ||
| 9146 | ✗ | return getInput(btnRight, true, true); | |
| 9147 | } | ||
| 9148 | 6080192 | bool DrunkrAbtn() | |
| 9149 | { | ||
| 9150 | 6080192 | return getInput(btnA, true, true); | |
| 9151 | } | ||
| 9152 | 6097024 | bool DrunkrBbtn() | |
| 9153 | { | ||
| 9154 | 6097024 | return getInput(btnB, true, true); | |
| 9155 | } | ||
| 9156 | 71669 | bool DrunkrEx1btn() | |
| 9157 | { | ||
| 9158 | 71669 | return getInput(btnEx1, true, true); | |
| 9159 | } | ||
| 9160 | 71662 | bool DrunkrEx2btn() | |
| 9161 | { | ||
| 9162 | 71662 | return getInput(btnEx2, true, true); | |
| 9163 | } | ||
| 9164 | ✗ | bool DrunkrEx3btn() | |
| 9165 | { | ||
| 9166 | ✗ | return getInput(btnEx3, true, true); | |
| 9167 | } | ||
| 9168 | ✗ | bool DrunkrEx4btn() | |
| 9169 | { | ||
| 9170 | ✗ | return getInput(btnEx4, true, true); | |
| 9171 | } | ||
| 9172 | ✗ | bool DrunkrSbtn() | |
| 9173 | { | ||
| 9174 | ✗ | return getInput(btnS, true, true); | |
| 9175 | } | ||
| 9176 | ✗ | bool DrunkrMbtn() | |
| 9177 | { | ||
| 9178 | ✗ | return getInput(btnM, true, true); | |
| 9179 | } | ||
| 9180 | 6687269 | bool DrunkrLbtn() | |
| 9181 | { | ||
| 9182 | 6687269 | return getInput(btnL, true, true); | |
| 9183 | } | ||
| 9184 | 6683794 | bool DrunkrRbtn() | |
| 9185 | { | ||
| 9186 | 6683794 | return getInput(btnR, true, true); | |
| 9187 | } | ||
| 9188 | ✗ | bool DrunkrPbtn() | |
| 9189 | { | ||
| 9190 | ✗ | return getInput(btnP, true, true); | |
| 9191 | } | ||
| 9192 | |||
| 9193 | 9336 | void eat_buttons() | |
| 9194 | { | ||
| 9195 | 9336 | getInput(btnA, true, false, true); | |
| 9196 | 9336 | getInput(btnB, true, false, true); | |
| 9197 | 9336 | getInput(btnS, true, false, true); | |
| 9198 | 9336 | getInput(btnM, true, false, true); | |
| 9199 | 9336 | getInput(btnL, true, false, true); | |
| 9200 | 9336 | getInput(btnR, true, false, true); | |
| 9201 | 9336 | getInput(btnP, true, false, true); | |
| 9202 | 9336 | getInput(btnEx1, true, false, true); | |
| 9203 | 9336 | getInput(btnEx2, true, false, true); | |
| 9204 | 9336 | getInput(btnEx3, true, false, true); | |
| 9205 | 9336 | getInput(btnEx4, true, false, true); | |
| 9206 | 9336 | } | |
| 9207 | |||
| 9208 | // Is true for the _first frame_ of a key press. | ||
| 9209 | // But! it is possible that a script manually sets the value of KeyPress, | ||
| 9210 | // in which case it will be restored to the "true" value based on `key_current_frame` | ||
| 9211 | // and `key_previous_frame` on the next frame. | ||
| 9212 | 13 | bool zc_readkey(int32_t k, bool ignoreDisable) | |
| 9213 | { | ||
| 9214 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if(ignoreDisable) return KeyPress[k]; |
| 9215 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | switch(k) |
| 9216 | { | ||
| 9217 | case KEY_F7: | ||
| 9218 | case KEY_F8: | ||
| 9219 | case KEY_F9: | ||
| 9220 | ✗ | return KeyPress[k]; | |
| 9221 | |||
| 9222 | default: | ||
| 9223 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | return KeyPress[k] && !disabledKeys[k]; |
| 9224 | } | ||
| 9225 | 13 | } | |
| 9226 | |||
| 9227 | // Is true for _every frame_ a key is held down. | ||
| 9228 | // But! it is possible that a script manually sets the value of KeyInput, | ||
| 9229 | // in which case it will be restored to the "true" value based on `key_current_frame` | ||
| 9230 | // on the next frame. | ||
| 9231 | ✗ | bool zc_getkey(int32_t k, bool ignoreDisable) | |
| 9232 | { | ||
| 9233 | ✗ | if(ignoreDisable) return KeyInput[k]; | |
| 9234 | ✗ | switch(k) | |
| 9235 | { | ||
| 9236 | case KEY_F7: | ||
| 9237 | case KEY_F8: | ||
| 9238 | case KEY_F9: | ||
| 9239 | ✗ | return KeyInput[k]; | |
| 9240 | |||
| 9241 | default: | ||
| 9242 | ✗ | return KeyInput[k] && !disabledKeys[k]; | |
| 9243 | } | ||
| 9244 | ✗ | } | |
| 9245 | |||
| 9246 | // Reads (and then clears) the current frame key state directly. | ||
| 9247 | // Scripts can also modify `key_current_frame`. | ||
| 9248 | 300 | bool zc_readrawkey(int32_t k, bool ignoreDisable) | |
| 9249 | { | ||
| 9250 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 298 times.
|
300 | if(zc_getrawkey(k, ignoreDisable)) |
| 9251 | { | ||
| 9252 | 2 | _key[k]=key[k]=key_current_frame[k]=0; | |
| 9253 | 2 | return true; | |
| 9254 | } | ||
| 9255 | 298 | _key[k]=key[k]=key_current_frame[k]=0; | |
| 9256 | 298 | return false; | |
| 9257 | 300 | } | |
| 9258 | |||
| 9259 | // Reads the current frame key state directly. | ||
| 9260 | // Scripts can also modify `key_current_frame`. | ||
| 9261 | 63238933 | bool zc_getrawkey(int32_t k, bool ignoreDisable) | |
| 9262 | { | ||
| 9263 |
2/2✓ Branch 0 taken 53953953 times.
✓ Branch 1 taken 9284980 times.
|
63238933 | if(ignoreDisable) return key_current_frame[k]; |
| 9264 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9284980 times.
|
9284980 | switch(k) |
| 9265 | { | ||
| 9266 | case KEY_F7: | ||
| 9267 | case KEY_F8: | ||
| 9268 | case KEY_F9: | ||
| 9269 | ✗ | return key_current_frame[k]; | |
| 9270 | |||
| 9271 | default: | ||
| 9272 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9284980 times.
|
9284980 | return key_current_frame[k] && !disabledKeys[k]; |
| 9273 | } | ||
| 9274 | 63238933 | } | |
| 9275 | |||
| 9276 | // Only used for a handful of keys, like tilde and Function keys. | ||
| 9277 | // This state is never read within the game. | ||
| 9278 | // It exists so that all keyboard input still functions during replay, | ||
| 9279 | // without inadvertently doing things like toggling throttling if the player | ||
| 9280 | // presses ~ | ||
| 9281 | 9284954 | bool zc_get_system_key(int32_t k) | |
| 9282 | { | ||
| 9283 | 9284954 | return key_system[k]; | |
| 9284 | } | ||
| 9285 | |||
| 9286 | // True for the _first_ frame of a key press. | ||
| 9287 | 83564586 | bool zc_read_system_key(int32_t k) | |
| 9288 | { | ||
| 9289 | 83564586 | return key_system_press[k]; | |
| 9290 | } | ||
| 9291 | |||
| 9292 | 1179189158 | bool is_system_key(int32_t k) | |
| 9293 | { | ||
| 9294 |
2/2✓ Branch 0 taken 1095624572 times.
✓ Branch 1 taken 83564586 times.
|
1179189158 | switch (k) |
| 9295 | { | ||
| 9296 | case KEY_BACKQUOTE: | ||
| 9297 | case KEY_CLOSEBRACE: | ||
| 9298 | case KEY_END: | ||
| 9299 | case KEY_HOME: | ||
| 9300 | case KEY_OPENBRACE: | ||
| 9301 | case KEY_PGDN: | ||
| 9302 | case KEY_PGUP: | ||
| 9303 | case KEY_TAB: | ||
| 9304 | case KEY_TILDE: | ||
| 9305 | 83564586 | return true; | |
| 9306 | } | ||
| 9307 | 1095624572 | return is_Fkey(k); | |
| 9308 | 1179189158 | } | |
| 9309 | |||
| 9310 | 9284954 | void update_system_keys() | |
| 9311 | { | ||
| 9312 |
2/2✓ Branch 0 taken 1179189158 times.
✓ Branch 1 taken 9284954 times.
|
1188474112 | for (int32_t q = 0; q < 127; ++q) |
| 9313 | { | ||
| 9314 |
2/2✓ Branch 0 taken 194984034 times.
✓ Branch 1 taken 984205124 times.
|
1179189158 | if (!is_system_key(q)) |
| 9315 | 984205124 | continue; | |
| 9316 | |||
| 9317 | 194984034 | key_system[q] = key[q]; | |
| 9318 |
1/2✓ Branch 0 taken 194984034 times.
✗ Branch 1 not taken.
|
194984034 | key_system_press[q] = key_system[q] && !key_system_previous[q]; |
| 9319 | 194984034 | key_system_previous[q] = key_system[q]; | |
| 9320 | 194984034 | } | |
| 9321 | 9284954 | } | |
| 9322 | |||
| 9323 | 10389244 | void update_keys() | |
| 9324 | { | ||
| 9325 |
2/2✓ Branch 0 taken 1319433988 times.
✓ Branch 1 taken 10389244 times.
|
1329823232 | for (int32_t q = 0; q < 127; ++q) |
| 9326 | { | ||
| 9327 | // When replaying, replay.cpp takes care of updating `key_current_frame`. | ||
| 9328 |
1/2✓ Branch 0 taken 1319433988 times.
✗ Branch 1 not taken.
|
1319433988 | if (!replay_is_replaying()) |
| 9329 | ✗ | key_current_frame[q] = key[q]; | |
| 9330 | |||
| 9331 |
2/2✓ Branch 0 taken 1309647613 times.
✓ Branch 1 taken 9786375 times.
|
1319433988 | KeyPress[q] = key_current_frame[q] && !key_previous_frame[q]; |
| 9332 | 1319433988 | KeyInput[q] = key_current_frame[q]; | |
| 9333 | 1319433988 | key_previous_frame[q] = key_current_frame[q]; | |
| 9334 | 1319433988 | } | |
| 9335 | 10389244 | } | |
| 9336 | |||
| 9337 | ✗ | bool zc_disablekey(int32_t k, bool val) | |
| 9338 | { | ||
| 9339 | ✗ | switch(k) | |
| 9340 | { | ||
| 9341 | case KEY_F7: | ||
| 9342 | case KEY_F8: | ||
| 9343 | case KEY_F9: | ||
| 9344 | ✗ | return false; | |
| 9345 | |||
| 9346 | default: | ||
| 9347 | ✗ | disabledKeys[k] = val; | |
| 9348 | ✗ | return true; | |
| 9349 | } | ||
| 9350 | ✗ | } | |
| 9351 | |||
| 9352 | ✗ | void zc_putpixel(int32_t layer, int32_t x, int32_t y, int32_t cset, int32_t color, int32_t timer) | |
| 9353 | { | ||
| 9354 | ✗ | timer=timer; | |
| 9355 | ✗ | particles.add(new particle(zfix(x), zfix(y), layer, cset, color)); | |
| 9356 | ✗ | } | |
| 9357 |